fork(1) download
  1. #include <stdio.h>
  2.  
  3. #include <stdlib.h>
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. void func(int,char);
  9. void(*func_2(void(*pfunc())(int,char)))(int,char);
  10.  
  11. int main()
  12.  
  13. {
  14. void(*pfunc_1)(int,char) = func_2(func);
  15. pfunc_1(343,'S');
  16. return 0;
  17. }
  18.  
  19. void func(int x,char y)
  20. {printf("\nx = %d, y = %c\n",x,y);}
  21.  
  22. void(*func_2(void(*pfunc())(int,char)))(int,char)
  23. {return pfunc();}
Compilation error #stdin compilation error #stdout 0s 3460KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:14:46: error: invalid conversion from 'void (*)(int, char)' to 'void (* (*)())(int, char)' [-fpermissive]
        void(*pfunc_1)(int,char) = func_2(func);
                                              ^
prog.cpp:9:7: note:   initializing argument 1 of 'void (* func_2(void (* (*)())(int, char)))(int, char)'
 void(*func_2(void(*pfunc())(int,char)))(int,char);
       ^
stdout
Standard output is empty