I want to declare a pointer type which point to a function, so I try:
typedef void (*print)(void);
works perfect
void (*print)(void);
p is a ponter variable , not a type.
typedef (void) (*print)(void);
error expected identifier or ‘(’ before ‘void’
typedef void (*)(void) Print;
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘_ attribute _’ before ‘Print’ .
My question is:
Do I have to use
typedef
to declare a function pointer type ?Why
typedef (void) (*print)(void);
is wrong ? what()
means here?Why I can't write in this way:
typedef void (*)(void) Print
?