Hi
What's going wrong with code that is why printf is not printing X
Code:#include<stdio.h>
void foo (void )
{
printf(" X");
}
int main(void)
{
void (*Fp)(void) = &foo;
(*Fp) ;
return 0;
}
Printable View
Hi
What's going wrong with code that is why printf is not printing X
Code:#include<stdio.h>
void foo (void )
{
printf(" X");
}
int main(void)
{
void (*Fp)(void) = &foo;
(*Fp) ;
return 0;
}
You aren't calling the function, just "mentioning" the function name, which does nothing.
Code:#include <stdio.h>
void foo()
{
printf("X\n");
}
int main()
{
void (*f)(void) = &foo; // don't actually need the &
(*f)(); // the parens that contain the arguments (if any) constitute
// the "function call operator"
f(); // and you don't actually need the dereference operator
return 0;
}