int main() { char ch; const char * a = &ch; a = nullptr; *a = '\0'; char * const b = &ch; b = nullptr; *b = '\0'; const char & d = ch; d = '\0'; char & const e = ch; char const & f = ch; f = '\0'; }
Standard input is empty
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]
Standard output is empty