fork download
  1. struct bar {
  2. int x;
  3. };
  4.  
  5. struct foo {
  6. struct bar *bar;
  7. };
  8.  
  9. int main(void) {
  10. struct bar bar1 = {0};
  11. struct bar bar2 = {0};
  12. struct foo x = {&bar1};
  13. const struct foo *const_x = &x;
  14. // const_x->bar = &bar2; // ILLEGAL
  15. const_x->bar->x = 42; // LEGAL
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 2164KB
stdin
Standard input is empty
stdout
Standard output is empty