fork download
  1. #include <stdio.h>
  2.  
  3. short global = 2;
  4. short * ptr_to_global = &global;
  5.  
  6. short* scary_fun(double* ptr) {
  7. return ptr_to_global;
  8. }
  9.  
  10. int main(void) {
  11. double val = 22.0;
  12. double *ptr_to_val = &val;
  13. short* (*scary)(double*);
  14. scary = &scary_fun;
  15. printf("%d", *(scary(ptr_to_val)));
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
2