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
Const question
Const question
May 1, 2012 at 9:20pm
May 1, 2012 at 9:20pm UTC
jag4205
(20)
Are the following statements valid? Why?
const int m =200;
const int * q = &m;
++(*q);
++q;
May 1, 2012 at 9:27pm
May 1, 2012 at 9:27pm UTC
guestgulkan
(2942)
What do you think and why?
May 1, 2012 at 9:28pm
May 1, 2012 at 9:28pm UTC
jag4205
(20)
No, but i'm not sure why. That's why i am asking
May 1, 2012 at 9:33pm
May 1, 2012 at 9:33pm UTC
Peter87
(11251)
What do you think const means?
May 1, 2012 at 9:34pm
May 1, 2012 at 9:34pm UTC
jag4205
(20)
const allows you to specify whether or not a variable is modifiable.
May 1, 2012 at 9:36pm
May 1, 2012 at 9:36pm UTC
Pter0dactyl
(196)
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.