Pointers are a type of data widely used in C language. They can be used to compile a refined and efficient program, which is also powerful and attractive.
I. pointer Declaration
Int (* func) (int * p, int (* f) (int *));
Int (* func [5]) (int * p );
Int (* func) [5]) (int * p );
* Func is a pointer at this time. A [] operator number on the right indicates that func is a pointer to an array. The elements of this array are pointers to functions, the Pointer Points to a function that has an int * type parameter and returns an int type.
Int (* func) (int * p) [5];
Func is a function pointer. This type of function has an int * type parameter. The returned value is a pointer to an array, and the elements to the array are arrays with five int elements.
Ii. pointer operation
Pointer operations are address operations. Therefore, only a limited number of operations are allowed. Generally, they point to a certain storage unit. addition and subtraction of pointers and integers are used to move pointers, the two pointers subtract to get the number of data between the two addresses. The comparison between the pointer and the pointer or the pointer and the address determines the sequence of the storage location pointed to by the pointer. During pointer operation, note that the data type referred to by the pointer is very important.
After understanding the pointer statements and pointer operations, the next article will make a difference and demonstration on specific pointer usage.