fork download
  1. #include <stdio.h>
  2.  
  3. void funcPtr(int a);
  4.  
  5. int main(){
  6.  
  7. int k=1;
  8.  
  9. void (*funcPtr2)(int);
  10.  
  11. funcPtr2 = (void*)(funcPtr);
  12.  
  13. // funcPtr2 = (void(*)(int))(funcPtr);
  14.  
  15. (*funcPtr2)(k);
  16.  
  17. return 0;
  18.  
  19. }
  20.  
  21. void funcPtr(int a){
  22.  
  23. printf("%d", a);
  24.  
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:11:13: error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic]
  funcPtr2 = (void*)(funcPtr);
             ^
prog.c:11:11: error: ISO C forbids assignment between function pointer and ‘void *’ [-Werror=pedantic]
  funcPtr2 = (void*)(funcPtr);
           ^
cc1: all warnings being treated as errors
stdout
Standard output is empty