What is the output of the following C program on a 64-bit system?
#include <stdio.h>
int main(void) {
struct { int a, b; } s1 = {1, 2}, s2;
s2 = s1;
s2.b = 9;
printf("%d %d\n", s1.b, s2.b);
return 0;
}
Both variables are declared in one declaration, so they share the same (unnamed) type and can be assigned. The assignment copies, so changing s2 leaves s1 alone.