I read the tutorial on function pointers, the arguments of the declaration of the pointer is not clear. The following code does not work :
Code:
# include <stdio.h>
int (int a, int b)
(
return a * b;
)
int (int c, int d)
(
return c / d;
)
int main ()
(
int a = 20;
int b = 20;
int d = 100;
int (* p) (int, int) = NULL;
p = & function2;
int (* p2) (int, int) = NULL;
p2 = & function3;
int (* t [2]) () = (p (a, b), p2 (p (a, b), d))
printf ( "Result:% d \ n", (* p) (a, b));
printf ( "Result:% d \ n", (* p2) (p (a, b), d));
printf ( "\ n");
printf ( "Result:% d \ n", t [0 ]());
printf ( "Result:% d \ n", t [1 ]());
getchar ();
return 0;
)
Bookmarks