prog.c:3:11: warning: type defaults to ‘int’ in declaration of ‘BinaryOperation’ [-Wimplicit-int]
typedef (*BinaryOperation)(int x);
^
prog.c: In function ‘get_operation’:
prog.c:19:2: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
pcontext = (int*)malloc(sizeof(int));
^
prog.c:19:19: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]
pcontext = (int*)malloc(sizeof(int));
^
prog.c:24:3: warning: return from incompatible pointer type [enabled by default]
return add;
^
prog.c:26:3: warning: return from incompatible pointer type [enabled by default]
return sub;
^
prog.c:28:10: error: ‘mul’ undeclared (first use in this function)
return mul;
^
prog.c:28:10: note: each undeclared identifier is reported only once for each function it appears in
prog.c: In function ‘main’:
prog.c:36:40: error: ‘OP_ADD’ undeclared (first use in this function)
BinaryOperation op = get_operation(0, OP_ADD, &cnt);
^
prog.c:36:2: warning: passing argument 3 of ‘get_operation’ from incompatible pointer type [enabled by default]
BinaryOperation op = get_operation(0, OP_ADD, &cnt);
^
prog.c:5:17: note: expected ‘int *’ but argument is of type ‘int **’
BinaryOperation get_operation(int base, int opcode, int *pcontext)
^
prog.c:38:3: warning: passing argument 1 of ‘op’ makes integer from pointer without a cast [enabled by default]
printf("%d\n", op(cnt, 1));
^
prog.c:38:3: note: expected ‘int’ but argument is of type ‘int *’
prog.c:38:3: error: too many arguments to function ‘op’
prog.c:39:3: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
free(cnt);
^
prog.c:39:3: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default]
prog.c: In function ‘get_operation’:
prog.c:31:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^