fork download
  1. #include <stdio.h>
  2.  
  3. static const int foo = 10;
  4.  
  5. int constsum(void) {
  6. return foo + 5;
  7. }
  8.  
  9. int main(int argc, char* argv[]) {
  10. int a = constsum();
  11. int* newFoo = const_cast<int*>(&foo);
  12. *newFoo = 20;
  13. int b = constsum();
  14. printf("%d\n", a + b);
  15. return 0;
  16. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
30