M
mdh
I am curious as to why the lines commented out also seem to work?( I
thought that the declaration of the pointer needed to mimic the
function it is supposed to point to, hence I expected void(*p)(char)
to work, which it does.)
#include <stdio.h>
int main (int argc, const char * argv[]) {
void myf(char);
void (*p)(char);
/* also works: void (*p)(); */
/* also works: int (*p)(); */
p=myf;
p('u');
return 0;
}
void myf( char c){
printf("Character is %c\n", c);
}
thought that the declaration of the pointer needed to mimic the
function it is supposed to point to, hence I expected void(*p)(char)
to work, which it does.)
#include <stdio.h>
int main (int argc, const char * argv[]) {
void myf(char);
void (*p)(char);
/* also works: void (*p)(); */
/* also works: int (*p)(); */
p=myf;
p('u');
return 0;
}
void myf( char c){
printf("Character is %c\n", c);
}