0
How to point to a function that returns a pointer
I have following code: typedef struct{ int age; }PERSON; PERSON *func(PERSON *person){ person->age=43; return person; } void main() { PERSON new={6}; PERSON *ptr; PERSON (*pointToFunction)(PERSON *)=&func; ptr=(*pointToFunction)(&new);//When I do that I get an error called "initialization from incompatible type [-Wincompatible-pointer-types] } How can I fix it?
3 ответов
+ 3
I remembered the method that you used. I have forgotten the logic of pointing to a function. Thank you @kurwius
+ 3
For the future:
When asking questions involving code, link to the code instead of copy & paste. Makes it easier to read and test.
+ 1
I will consider it @Jacob Pembleton