Home > Back-end > C language pointer complex definitions
C language pointer complex definitions
Time:03-23
Look not to understand the c language definition Char * (* a [3]) (int * * p) A is a pointer to the three elements of an array, each pointer to a prototype for the char * func (int * * p) as a function of This function is not the same as the return type? And the prototype char * func (int * * p) is a function pointer? Char * func (int * * p) I understand it right? Func is a pointer to the return type is int the secondary, char * pointer to the function,
CodePudding user response:
Char * (* a [3]) * * p (int) is an array of three elements, the element type is char * func (int * *) This is a function, the function of the return value is char * parameter is int * *
CodePudding user response:
char * func (int * * p
This is the function variables;
Can use a [0]=func. This assignment; Can also be a [0]=& amp; Func.
Call can use a [0] (p); Examples are as follows:
# include & lt; Stdio. H>
* * a char * func (int);
Int main (void) { Int * * p=NULL; Char * (* a [3]) (int * *);
//two spelled the same as //a [0]=func. A [0]=& amp; Func.
A [0] (p);
return 0; }
Char * func (int * * a) { Printf (" % p \ n ", a);
Printf (" helloworld! \n"); Return NULL; }
Because func function name is the name, address and do not add & amp; Can be,