cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
typedef
typedef
Oct 19, 2012 at 6:29am UTC
geekocoder
(103)
How can P be a constant in the following code?
1
2
3
typedef
char
*charp;
const
charp P;
Oct 19, 2012 at 7:53am UTC
coder777
(8444)
the
const
on line 3 applies to the type
charp
. The type
charp
is a pointer to a char. So line 3 defines a const pointer to a char or in other words:
char
*
const
P;
It means that you cannot modify the pointer while the object it points to you can
Topic archived. No new replies allowed.