![]() |
Pointers and Structures
I have a complex query,
I have a structure some thing like this, typedef struct mod_Definition_T_Tag { int x; char y; float p; } mod_Definition_T; if in the code if the declaration is made as follows: typedef mod_Definition_T *(*create_func_t)(const char *config_str); what does this indicate or how do we put them in plain english statement ? |
Re: Pointers and Structures
Is there any way by which we can access a function using the functions address alone?
|
Re: Pointers and Structures
typedef mod_Definition_T *(*create_func_t)(const char *config_str);This declares a function pointer type called "create_func_t". It takes a const char* as an argument and returns a mod_Definition_T *.A simpler example of a function pointer declaration is: typedef int (*func) (int);This declares a function pointer type called func which takes an intand returns an int. You define function pointer variables from it like this:func a, b, c; // a, b, and c are function pointers of type func.And you can use the function pointers just like regular function names: int x = a(5);Your original example might be used something like this: create_func_t cft;Quote:
|
| All times are GMT +5.5. The time now is 11:40. |