Question OOP-CTOR-0013
MediumWhat is the output of this code?
#include <iostream>
using namespace std;
struct P {
int x, y;
P(int a = 0, int b = 0) : x(a), y(b) {}
};
int main() {
P p, q(5), r(5, 7);
cout << p.x << " " << p.y << " " << q.x << " " << q.y << " " << r.x << " " << r.y;
return 0;
}
- A.
Error
- B.
0 0 5 0 5 7
- C.
Sign up free to see the answer and a step-by-step explanation.