Search:
Forum
Beginners
Why is dangerous to run this?
[try Beta version]
Not logged in
register
log in
user name:
password:
remember me
forgot your password?
or sign in using:
try again
cancel
forgot your password?
Why is dangerous to run this?
May 23, 2013 at 9:54pm
May 23, 2013 at 9:54pm UTC
lucratico15
(6)
I have an exam tomorrow and one of the question from the review is to explain it is dangerous to run a program with this part of the code and what could happen?
1
2
char
*myPtr; *(myPtr + 2) =
'0'
;
May 23, 2013 at 10:07pm
May 23, 2013 at 10:07pm UTC
vlad from moscow
(6539)
myPtr has undefined value because it was not initialized or assigned. So the code
*(myPtr + 2) = '0';
has undefined behaviour. Where character '0' will be written?
May 23, 2013 at 10:32pm
May 23, 2013 at 10:32pm UTC
lucratico15
(6)
Thanks
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs