C
conrad
What are some of the fundamental differences
between const in C++ and const in C?
I know const in C does not mean 'constant'
but iirc const in C++ does. Additionally,
in C, one thinks of const as meaning 'read-only'.
There also exist oddities in C with
the use of const in association with pointer
objects and that such oddities do not exist
in C++. For example, const char **foo;
In C, the above is a pointer to type
"pointer to char read-only" and so
assignments like the following
cannot be made:
const char **foo;
char **baz;
foo = baz;
But in C++, I think I remember
reading that this works.
Any clarification welcomed.
between const in C++ and const in C?
I know const in C does not mean 'constant'
but iirc const in C++ does. Additionally,
in C, one thinks of const as meaning 'read-only'.
There also exist oddities in C with
the use of const in association with pointer
objects and that such oddities do not exist
in C++. For example, const char **foo;
In C, the above is a pointer to type
"pointer to char read-only" and so
assignments like the following
cannot be made:
const char **foo;
char **baz;
foo = baz;
But in C++, I think I remember
reading that this works.
Any clarification welcomed.