[ create a new paste ] login | about

Link: http://codepad.org/LxLqcKRM    [ raw code | output | fork ]

C, pasted on Nov 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <string.h>

int (*fptrOperation)(int (*)(int,int),int,int);

int compute(int (*operation)(int,int), int num1, int num2) {
    return operation(num1, num2);
}

int add(int num1, int num2) {
    return num1 + num2;
}

int main(void)
{
    fptrOperation = compute;
    printf("%d\n",fptrOperation(add,5,6));
    return 1;
}


Output:
1
11


Create a new paste based on this one


Comments: