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
Is typecast permanent?
Is typecast permanent?
Dec 23, 2010 at 9:08pm UTC
Kieth89
(94)
If I have this snip of code:
cout << ps << “ at “ << (
int
*) ps << endl;
Does it turn the ps pointer into a point-to-int forever or just for that particular output line?
Dec 23, 2010 at 9:09pm UTC
m4ster r0shi
(2201)
The latter.
Dec 23, 2010 at 9:10pm UTC
Albatross
(4553)
A type-cast can be thought of as a translation. In this case you're translating between whatever ps is and an int*, but going with the translation analogy, the translation does not directly change the original text. So... nope!
-Albatross
Topic archived. No new replies allowed.