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
Code logic question
Code logic question
Nov 4, 2015 at 12:59am UTC
helloworld135
(67)
nm
Last edited on
Nov 4, 2015 at 7:30pm UTC
Nov 4, 2015 at 1:12am UTC
cire
(8284)
It compiles but I'm not sure if it's correct.
I don't know how it compiles.
tmp
is a pointer. Line 4 is illegal if
tmp
is a pointer. What's with the names
tmp
and
temp
?
Nov 4, 2015 at 1:17am UTC
helloworld135
(67)
nm
Last edited on
Nov 4, 2015 at 7:30pm UTC
Nov 4, 2015 at 11:54am UTC
MikeyBoy
(5631)
So you're declaring a vector called
tmp
, and then in the ranged for loop, you're shadowing that by declaring a pointer called
tmp
? Shadowing variables like that is not a good idea, because it easily leads to confusion.
What is
temp
?
Topic archived. No new replies allowed.