1
0

17-ptr-fun.c 278 B

12345678910111213141516171819
  1. #include <stdio.h>
  2. int add(int a, int b) {
  3. return a + b; }
  4. int subtract(int a, int b) {
  5. return a - b; }
  6. int main() {
  7. int (*ptr)(int, int);
  8. ptr = add;
  9. printf("Addition: %d\n", ptr(2, 3));
  10. ptr = subtract;
  11. printf("Subtraction: %d\n", ptr(5, 3));
  12. return 0;
  13. }