A pointer is a special variable. The value stored in it is interpreted as an address in the memory. To understand a pointer, we need to understand the four aspects of the pointer:
Pointer type, pointer type, pointer value, memory area pointed to by pointer, memory area occupied by pointer itself.
In a 32-bit program, the value of all types of pointers is a 32-bit integer, because the 32-bit program's memory address is all 32-bit long.
The memory area pointed to by the pointer starts from the memory address represented by the pointer value, and the length is a memory area of sizeof (type pointed to by the pointer.
On a 32-bit platform, the pointer occupies 4 bytes.
Pointer meaning analysis
Int p;
// This is a common integer variable
Int * p;
// Start with P and combine with * first, so P is a pointer and then int, indicating that the type of content pointed to by the pointer is int. so P is a pointer to return integer data.
Int p [3];
// First, start from P and combine with [], indicating that P is an array and then combine with int, indicating that the elements in the array are integral/type, therefore, P is an array composed of integer data.
Int * p [3];
// Start with P and combine it with [] First. Because the priority is higher than *, P is an array first and then combined, it means that the elements in the array are pointer types, and then combined with int, it means that the type of the content pointed to by the pointer is integer, so P is an array composed of pointers that return integer data.
Int (* p) [3];
// Start with P and first combine with *, indicating that P is a pointer first, and then combine with [] (and "()", which can be ignored, only to change the priority), it means that the pointer points to an array, and then combined with int, it means that the elements in the array are integer. therefore, P is a pointer to an array composed of integer data.
Int ** p;
// First, start with P, first combine with *, that is, P is a pointer, and then combine with *, indicating that the element pointed to by the pointer is a pointer, and then combine with int, the Pointer Points to an integer. since second-level pointers and more advanced pointers are rarely used in complex types, we will not consider multi-level pointers for more complex types. At most, we will only consider first-level pointers.
Int p (int );
// Starting from P, it is first combined with (), indicating that P is a function and then goes to () for analysis, it indicates that the function has an integer Variable Parameter and is then combined with an external int, indicating that the return value of the function is an integer data.
Int (* p) (int );
// Starting from P, it is first combined with the pointer, indicating that P is a pointer, and then combined with (), indicating that the pointer points to a function, and then () the int combination in indicates that the function has an int-type parameter, and is combined with the outermost int, indicating that the return type of the function is integer, so P is a pointer to a function with an integer parameter and return an integer type.
Int * (* p (int) [3];
// You can skip it first, without looking at this type. It is too complicated. Starting from P, it is first combined with (), indicating that P is a function and then enters (), which is combined with int, it indicates that the function has an integer variable parameter, and then it is combined with the external *, indicating that the function returns a pointer, and then goes to the outermost layer, first in combination, it indicates that the returned Pointer Points to an array and then is combined with *. The elements in the/Ming array are pointers and then combined with int, indicating that the Pointer Points to integer data. therefore, P is a function that takes an integer value and returns a pointer variable pointing to an array composed of integer pointer variables.