In c language learning, pointers, arrays, functions, etc. are well known to us, but when really encountered or really used, there is inevitably some confusion. Here's a look at pointers:
Pointer: Popular speaking is the address of the memory unit, is a constant. In other words, address.
Pointer variable: Allows a variable to hold a pointer in the C language, which is a pointer variable. is a variable. In other words, a variable that takes a value as an address. (But in peacetime we collectively refer to pointer variables as pointers, this to distinguish)
The type description of the pointer variable: the type specifier * variable name; two methods of initialization: int* p = &a or int* p;p = &a; ( It is a good habit to initialize the pointer when it is defined
Pointer variable operation: (1) Take address operator &: monocular operation, from right to left, function: Take variable address;
(2) Fetch content operator *: monocular operation, right-to-left, function: Used to denote a variable referred to by a pointer variable. (* is a type specifier in the type description)
Next, we will point out the difference between the array pointer, pointer array, function pointer, pointer function:
(1) Array pointer: The full name is the array pointer variable, pointer to the array variable becomes an array pointer variable, is a variable. Generic type: Type descriptor * pointer name
(2) Array of pointers: a set of ordered pointers. Generic type: type specifier * array name [array length]. This is the same as a two-dimensional array pointer variable but represents a different meaning.
(3) Function pointer: Full function pointer variable, a function always occupies a contiguous memory area, and the function name is the first address of the memory, assigning this address to a variable is a function pointer variable.
General form: type specifier (* pointer variable name) ();
(4) Pointer function: can be called pointer-type function, the return value is a pointer function. General form: type specifier * Function name (formal parameter list).
(three months into the park, still the same ignorance.) Last month determined to be a down-to-the-program ape, so began to supplement C knowledge. The above is a summary of their own, I hope you correct, at the same time I also summed up a bit).
C Pointer Summary