
Originally Posted by
john.c
Code:
#include <stdio.h>
void function1() { printf("Hello\n"); }
void function2(int x) { printf("x = %d\n", x); }
int function3(int y) { return y + 1; }
int function4() { return 42; }
int main ()
{
void (*f1)() = function1;
void (*f2)(int) = function2;
int (*f3)(int) = function3;
int (*f4)() = function4;
f1();
f2(f3(f4()));
return 0;
}
understood, Thanks for the effort
Code:
#include <stdio.h>
void function1() { printf("Hello\n"); }
void function2(int x) { printf("x = %d\n", x); }
int function3(int y) { return y + 1; }
int function4() { return 42; }
int main ()
{
int a, b;
void (*f1)() = function1;
void (*f2)(int) = function2;
int (*f3)(int) = function3;
int (*f4)() = function4;
a = f3(2);
printf("a = %d\n", a);
b = f4();
printf("b = %d\n", b);
return 0;
}
a = 3
b = 42