Const question

May 1, 2012 at 9:20pm
Are the following statements valid? Why?

const int m =200;

const int * q = &m;

++(*q);

++q;
May 1, 2012 at 9:27pm
What do you think and why?
May 1, 2012 at 9:28pm
No, but i'm not sure why. That's why i am asking
May 1, 2012 at 9:33pm
What do you think const means?
May 1, 2012 at 9:34pm
const allows you to specify whether or not a variable is modifiable.
May 1, 2012 at 9:36pm
actually 'constant' is a key word which tells the compiler that the value ain't gonna change throughout the run of program. and if you try to change it forcefully,"It flashes an error."
Topic archived. No new replies allowed.