cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
What does const pointer mean???
Page 2
What does const pointer mean???
Pages:
1
2
Feb 4, 2021 at 1:41pm
Feb 4, 2021 at 1:41pm UTC
JLBorges
(13770)
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
Feb 4, 2021 at 2:16pm UTC
keskiverto
(10425)
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:
1
2