Question 4
Back to Exercise
After the declaration int *p, q; what are p and q?
- A both are pointers to int
- B p is a pointer to int, q is an int Correct
- C p is an int, q is a pointer to int
- D it is a compile error
Correct Answer: Option B
The * belongs to the name next to it, not to the type. To declare two pointers write int *p, *q;. This is why many style guides declare one pointer per line.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!