fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void foo(int num)
  5. {
  6. int array[num];
  7. printf("inside foo(): sizeof(array) is %u! oh, mother fucking god!\n", sizeof(array));
  8. }
  9.  
  10. void bar(int num)
  11. {
  12. int array[num];
  13. printf("inside bar()\n");
  14. memset(array, 0x55, sizeof(array));
  15. }
  16.  
  17. int main(void)
  18. {
  19. setvbuf(stdout, NULL, _IONBF, 0);
  20.  
  21. const int num = 0x3fffffff;
  22.  
  23. printf("before foo()\n");
  24. foo(num);
  25. printf("after foo()\n");
  26.  
  27. printf("before bar()\n");
  28. bar(num);
  29. printf("after bar()\n");
  30.  
  31. return 0;
  32. }
  33.  
Runtime error #stdin #stdout 0s 2108KB
stdin
Standard input is empty
stdout
before foo()
inside foo(): sizeof(array) is 4294967292! oh, mother fucking god!
after  foo()
before bar()
inside bar()