What's the correct syntax for creating a typedef representing a pointer to a function?
Something like typedef int (*) (int x, int y) BINARY_OPERATOR;?
What's the correct syntax for creating a typedef representing a pointer to a function?
Something like typedef int (*) (int x, int y) BINARY_OPERATOR;?
It you have
A typedef for that would beCode:int foo ( char *msg );
Then you can sayCode:typedef int (*fnptr)(char*);
Code:fnptr var = foo;
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Makes sense, thanks.
This site has a lot of useful information when dealing with the sometimes-odd syntax of function pointers.
http://www.newty.de/fpt/index.html
If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein