MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Data Types
Pointers & References
Beginner
Q
In the C++ declaration int* p, q;, what are the types of p and q?
Ap is int*; q is int
Bp is int; q is int*
CBoth are int
DBoth are int*
Correct Answer:
A. p is int*; q is int
Explanation:
The * binds to the declarator, not the type, so it applies only to p. Write int *p, *q; for two pointers.
ALSO KNOW (related points):
• What is the main advantage of nullptr (C++11) over NULL? → It has its own type (std::nullptr_t) and is never mistaken for an integer during overload resolution