Correct answer for "Jumping into C++" chapter 13, quiz 3?
c++
Solution
`p_a` is a pointer pointing to a variable. That is, it yields the address of that variable.
`*p_a` is the value of the variable.
`&p_a` is the address of the pointer (pointers have memory locations too).
`address( p_a )` is some nonsense.
Hence the answer is A and the book is incorrect. Burn it.
Problem
Which of the following gives the memory address of a variable pointed to by pointer p_a? A. p_a; B. *p_a; C. &p_a; D. address( p_a ); So I'm reading this book called "Jumping into C++" and this quiz came up after one chapter. When I checked the right answer from the book it showed that the correct answer was C. &p_a;. Wouldn't &p_a just give the memory address of a pointer variable p_a instead of memory address of variable it is pointing to? Now I'd say that this is not the correct answer, but I can't be sure. After all I'm still a beginner so I don't dare to start questioning answers in the book just yet. I'd say that the correct answer is A. Tell me, is there a mistake in the answers or what?