fork download
  1. #include <stdio.h>
  2.  
  3. int sum(int a, int b){
  4. return a + b;
  5. }
  6.  
  7. int main(){
  8. void* foo = &sum;
  9. int (*f)(int, int) = foo;
  10. printf("Esta soma e ilegal? Soma = %d\n", f(10, 8));
  11. return 0;
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:8:17: error: ISO C forbids initialization between function pointer and ‘void *’ [-Werror=pedantic]
     void* foo = &sum;
                 ^
prog.c:9:26: error: ISO C forbids initialization between function pointer and ‘void *’ [-Werror=pedantic]
     int (*f)(int, int) = foo;
                          ^~~
cc1: all warnings being treated as errors
stdout
Standard output is empty