Some common definitions of pointers are summarized as follows:
Int F; an integer variable
Int * F; a pointer to an integer.
Int const * F; F is a pointer to an integer constant. You can modify the pointer value, but cannot modify the value it points.
Int * const F; F is a constant pointer to an integer. the pointer is a constant and its value cannot be modified. However, you can modify the value it points.
Int const * const F; the pointer itself or the value it points to is a constant and cannot be modified.
Int * F (); you can view * F () as an expression, which is actually int (* F (). (* F () as a whole. It is declared as an int. * F () => int, then f () (because the function call operation has a higher priority than the indirect access operator) is a pointer to an int type. F () is a function, so the return value type of this function is a pointer to an integer.
INT (* f) (); F is a function pointer, and the function to which it points returns an integer.
Int * (* f) (); F is a function, and the return value of the function to which it points is an integer pointer.
Int f [10]; F is an array, and its element is int.
INT (* f) [10]: F is a pointer pointing to an array containing 10 int values. F is also called an array pointer.
Int * f [10]; [] has a high priority. f [10] is an array and Its element type is a pointer to an int.
INT (* f []) (INT, INT); F is an array, and the elements of the array are pointers. Since () is followed, F is a function pointer array. The Return Value of the function is int.
Int * (* f []) (INT, INT); the only difference from the above is that the return value of the function is an integer pointer.
Function pointer:
Int F (INT );
INT (* PF) (INT) = & F; equivalentINT (* PF) (INT) = F;
During initialization, & is optional because the compiler always converts the function name into a function pointer when it is used. & The operator only shows the tasks that the compiler will implicitly execute.
References:
Pointers on C, kentha. reek