Home > Back-end >  C the callback function interface of two questions?
C the callback function interface of two questions?

Time:12-11

Please void * (*) what is the meaning and the void pointer function (*) what's the difference?
Void * __cdec1 function is what mean? __cdec1 do??

CodePudding user response:

Please void * (*) what is the meaning and the void pointer function (*) what's the difference?

Both are a function pointer, the first return value is a void *, the return value is the second it ya not return a value

There are three kinds of function call way
__cdecl default way
__stdcall winAPI functions are this way
__fastcall
As for the three difference, their online look for

https://www.cnblogs.com/yenyuloong/p/9626658.html

CodePudding user response:

reference 1st floor Minikinfish response:
what void * (*) what is the meaning and the void pointer function (*) what's the difference?

Both are a function pointer, the first return value is a void *, the return value is the second it ya not return a value

There are three kinds of function call way
__cdecl default way
__stdcall winAPI functions are this way
__fastcall
As for the three difference, their online look for

https://www.cnblogs.com/yenyuloong/p/9626658.html

Great god cow force thanks

CodePudding user response:

For a function pointer related content, please refer to the
"A function pointer in c + + 1"
"A function pointer in c + + 2"
Wish I could help you!

CodePudding user response:

//char (* * x [3] ()) [5]. What type of variable is//x? 
//
/analysis/C statement, the key is to find out what this variable is a (function, Pointers, arrays),
//is the function that is left is his arguments and return values,
//is a pointer that rest is shows that he points to what,
//is the rest of the array is a member of the array is what type,
//parsing rules of C language statement:
//start from the left side of the first identifier, carried out in accordance with the priority, * said is.. Pointer to a const said read-only, volatile variable, array [] says, are () function,
//
//x and [3] is a size of 3 array, the array of each element as a pointer, the pointer to a class of function, this function has no parameters and return type of a pointer, the pointer to a char array size is 5
#include
#include
Char num [5].
Char (* x00 ()) [5] {
Return & amp; Num.
}
Int main () {
Char (* * x [3] ()) [5].//is an array, the size is 3
Char * (* x0) () () [5].//an array of elements, is a function pointer
Char (* x00 () ()) [5].//function prototype, the parameter is null, the return value is a pointer
X000 char (*) [5];//the return value

X0=x00;
X [0]=x0;
X [1]=x0;
X [2]=x0;
Printf (" typeid (x). The name () is % s \ n ", the typeid (x). The name ());
return 0;
}
//the typeid (x). The name () is char (* (__cdecl * *) (void)) [5]
  • Related