Structure in computer memory.
- Variables are allocated storage in memory.
- Local variables live in the stack.
- Global variables live in the globals section
- Pointers are just variables that store memory addresses.
- The &operator finds the address of a variable.
- The *operator can read the contents of a memory address
- The *operator can also set the contents of a memory address.
- An array variable can be used as a pointer.
- The array variable points to the first element in the array.
- If you declare an array argument to a function, it will be treated as a pointer
- The sizeof operator returns the space taken by a piece of data.
- You can also call sizeoffor a data type, such as sizeof(int).
- sizeof(a pointer)returns 4 on 32-bit operating systems and 8 on 64-bit.
- Array variables can be used as pointers…but array variables are not quite the same.
- Sizeof is different for array and pointer variables.
- Array variables can’t point to anything else.
- Passing an array variable to a pointer decays it
- Arrays start at zero because of pointerarithmetic
- Pointer variables have types so they can adjust pointer arithmetic.
- If you see a *in a variable declaration, it means the variable will be a pointer.
- String literalsare stored in read-only memory.
- If you want to modify a string, you need to make a copy in a new array.
- You can declare a charpointer as const char *to prevent the code from using it to modify a string.
References : Head first C