What are values and addresses?
- values are things like:
- 1 (integer)
- 1.1 (real number)
- a (character)
- addresses are things like:
- 0x7fff68db4100 (hexidecimal number)
Why are values and addresses needed?
- Values are used by humans
- though a value like "1" is still kept in computer memory as some other type of machine readable concept (bit, byte, hexidecimal, etc)
- Addresses are used by computers
- addresses are represented in this way because computers work with binary values (i.e. 0/1, true/false, or on/off)
Analogy of Addresses and Values
Analogy of Addresses and Values
Concept | Programming World | Real World |
Address |
0x7fff68db4100 |
MSB114, 2500 Campus Rd, Honolulu, HI 96822 |
Value |
1.234 |
EE160 Class |
Things to note:
- addresses are physical locations that should be treated as not changing, like classroom MSB114
- values are transient data that can be modified, like MSB114 can house EE160 now and then later house another class like MATH101