fork download
  1. int main()
  2. {
  3. char ch;
  4.  
  5. const char * a = &ch;
  6. a = nullptr;
  7. *a = '\0';
  8.  
  9. char * const b = &ch;
  10. b = nullptr;
  11. *b = '\0';
  12.  
  13. const char & d = ch;
  14. d = '\0';
  15.  
  16. char & const e = ch;
  17.  
  18. char const & f = ch;
  19. f = '\0';
  20. }
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:7:7: error: assignment of read-only location ‘* a’
prog.cpp:10:6: error: assignment of read-only variable ‘b’
prog.cpp:14:6: error: assignment of read-only reference ‘d’
prog.cpp:16:15: error: ‘const’ qualifiers cannot be applied to ‘char&’
prog.cpp:19:6: error: assignment of read-only reference ‘f’
prog.cpp:16:15: warning: unused variable ‘e’ [-Wunused-variable]
stdout
Standard output is empty