CJCoding With Joseph
← Back to Question List
C++ Code Walkthrough #44

Struct Member Update

easyStructs

📄 Code

Read carefully — what does this print?
1#include <iostream>
2using namespace std;
3struct Point { int x, y; };
4int main() {
5 Point p = {3, 4};
6 p.x += p.y;
7 cout << p.x << " " << p.y << endl;
8 return 0;
9}

🎯 Your Answer