What does const pointer mean???

Pages: 12
Feb 4, 2021 at 1:41pm
No, it is not the same in C. In C, the type of a (narrow) string literal is 'array of N char' (there is no const qualification).

Nevertheless, even in C, "if a program attempts to modify the static array formed by a string literal, the behaviour is undefined."
https://en.cppreference.com/w/c/language/string_literal
Feb 4, 2021 at 2:16pm
I saw a comment that change to const was proposed for C standard, but rejected. They apparently prefer the "undefined behaviour" version.
Topic archived. No new replies allowed.
Pages: 12