fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main (int argc, char ** argv) {
  4. const int x = 1;
  5.  
  6. int *y;
  7. y = &x;
  8.  
  9. *y += 1;
  10.  
  11. printf("x = %d\n", x); // Prints: 2
  12. printf("y = %d\n", *y); // Prints: 2
  13.  
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:7:5: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   y = &x;
     ^
cc1: all warnings being treated as errors
stdout
Standard output is empty