typo
[asdevice.git] / test.c
blobf0a798e23210c61d51827713317bdf85e497c121
1 #include <stdio.h>
2 #include <stdlib.h>
4 typedef struct {
5 int a;
6 int b;
7 int (*ptFunction) (int, int);
8 } fraction;
10 int DoIt (int x, int y){ printf("DoIt\n"); return x+y;}
11 int DoIt2 (int x, int y){ printf("DoIt2\n"); return y-x;}
13 int main(){
14 fraction *f;
15 f = malloc(sizeof(fraction)*2);
17 f[0].a = 5;
18 f[0].b = 6;
19 f[0].ptFunction = &DoIt;
20 f[1].a = 10;
21 f[1].b = 11;
22 f[1].ptFunction = &DoIt2;
24 printf("f[1].a: %d, f[1].b: %d \n",f[1].a,f[1].b);
25 printf("call 0 : %d\n",f[0].ptFunction(f[0].a,f[0].b));
26 printf("call 1 : %d\n",f[1].ptFunction(f[1].a,f[1].b));
28 free(f);
30 return 1;