- Pointers and arrays
pointer is used to store the address of the variable;
& ARR represents the entire array;
ARR array name indicates the address of the first element;
dereferencing means that content pointer is
for example: char PTR = "abcdef";
PTR; // Pointer dereference it means that what it points to, namely abcdef
ptr; // ptr is stored in the address of the string
2. a pointer to
a pointer is a pointer, which put the elements that address, we can access elements the contents of the address to find the address stored in that element itself.
For example: char str1 [] = {1,2,3,4,5,6,7};
3. two pointers
two pointer is a pointer to a pointer, which is stored in a memory address pointer variable
For example: int a = 10;
int pa = & a;
int * ppa = & pa; // denotes a storage address in the pa, pa address stored in the ppa, pa is a class // pointer, two pointers are ppa .
4. pointer array
first pointer array is an array, each element of the array is a pointer type, where a pointer is used to modify the array in the 32-bit platform, the pointer is four bytes in size.
For example: char arr [. 4] = { "Hello", "World"}; // here arr is an array of pointers, that there are two elements, each element is a pointer type.
So, how to determine whether an array is a pointer to an array of it?
The best way is to add (), for example: char (ARR [. 4]); Next we can according to the symbol , and []
to determine the binding priority.
A pointer, two pointers, pointer array, arrays and pointers
Guess you like
Origin blog.51cto.com/14234314/2402484
Ranking