Code logic question

nm
Last edited on
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?
nm
Last edited on
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.