Question discussion

What is the output of the following C code (structs are copied by value)? struct Point { int x; int y; }; int main() { struct Point p1 = {1…

547Medium DSSSB TGT Computer Science 0 replies 1 views
0
What is the output of the following C code (structs are copied by value)? struct Point { int x; int y; }; int main() { struct Point p1 = {10, 20}; struct Point p2 = p1; p2.x = 99; printf("%d %d", p1.x, p2.x); return 0; }
  • A99 99
  • B10 99
  • C10 10
  • D99 10
Correct answer: B

Discussion 0

Nobody has replied yet. Start the discussion!