fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.  
  5. int i=1;
  6. char c = 'c';
  7. float f = 1.0;
  8.  
  9. double* p = &i;
  10. printf("%d\n",*(int*)p);
  11. p = &c;
  12. printf("%c\n",*(char*)p);
  13. p = &f;
  14. printf("%f\n",*(float*)p);
  15. return 0;
  16. }
  17.  
  18. Success
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:9:15: error: cannot convert 'int*' to 'double*' in initialization
  double* p = &i;
               ^
prog.cpp:11:4: error: cannot convert 'char*' to 'double*' in assignment
  p = &c;
    ^
prog.cpp:13:4: error: cannot convert 'float*' to 'double*' in assignment
  p = &f;
    ^
prog.cpp: At global scope:
prog.cpp:18:1: error: 'Success' does not name a type
 Success
 ^
stdout
Standard output is empty