#include <stdio.h>
//typedef int (fp)(int, int)//(fp) brackets are imp
int add(int a, int b) {
int sum = a + b;
return sum; // You need to return the sum from the function.
}
int main() {
int (*fp)(int, int); // Declare a function pointer that points to a function taking two ints and returning int.
fp = &add; // Assign the address of the 'add' function to the function pointer.
int sum = fp(5, 7); // Call the function through the function pointer.
printf("%d", sum);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: