R
Ravi
I have my TC++ help file which has the following in it:
const my_age = 39;
___________________________
WARNING: A const variable can be indirectly modified by a
pointer, as in
the following:
*(int *)&my_age = 35;
When the const modifier is used with a pointer parameter in
a function's
parameter list, the function cannot modify the variable
that the pointer
points to. For example,
int printf (const char *format, ...);
Here the printf function is prevented from modifying the
format string.
_________________
I can't figure out what they are trying to say.
Could someone help?
TIA.
const my_age = 39;
___________________________
WARNING: A const variable can be indirectly modified by a
pointer, as in
the following:
*(int *)&my_age = 35;
When the const modifier is used with a pointer parameter in
a function's
parameter list, the function cannot modify the variable
that the pointer
points to. For example,
int printf (const char *format, ...);
Here the printf function is prevented from modifying the
format string.
_________________
I can't figure out what they are trying to say.
Could someone help?
TIA.