1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| #include <stdio.h>
#include <stdlib.h>
long fonction2 (int a, int b)
{
return a + b;
}
int fonction3 (int c, int d)
{
return c / d;
}
int main (void)
{
int a = 6;
int b = 4;
int d = 2;
int (*p2) (int, int) = NULL;
int (*p3) (int, int) = NULL;
p2 = fonction2;
p3 = fonction3;
int (*t[2]) (int, int) = {p2, p3};
printf ("Resultat 1 %d\n", p2 (a, b));
printf ("Resultat 2 %d\n", p3 (p2(a, b), d));
printf ("Resultat 1 %d\n", t[0] (a, b));
printf ("Resultat 2 %d\n", t[1] (t[0] (a, b), d));
return EXIT_SUCCESS;
} |
Partager