Consider the following C++ code segment: int a = 10, b = 20; int *p = &a, *q =…
2018
Consider the following C++ code segment:
int a = 10, b = 20;
int *p = &a, *q = &b;
p = q;
With respect to the code segment mentioned above, which of the following statement is correct?
Answer: D. Both p and q will point to b
- A.
Both a and b will contain 10
- B.
Both a and b will contain 20
- C.
Both p and q will point to a
- D.
Both p and q will point to b
Attempted by 347 students.
Show answer & explanation
Correct answer: D
Loading lesson…