C TutorialLesson 21Free preview
C Memory Address
This lesson is part of C · All levels
Summary
Each variable in the program is stored in a specific memory location that has a unique hexadecimal address. In C the address of a variable can be obtained by adding the sign & before it, e.g. &age. The memory address becomes the basis of the pointer's work and the mechanism of passing parameters to the function. Operators & take addresses, whereas operators * in the context of declarations are used to store or read values on those addresses.
Key points
- Each variable has a unique memory address that can be viewed with &
- The address format is generally displayed as a hexadecimal such as 0x7ffd4a2b
- The value at a particular address can be taken with the operator
- Addresses are never zero; NULL is used as an empty address marker
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.