I'm trying to learn C and I've come across something weird:
struct
{
int i;
double j;
} x, y;
struct
{
int i;
double j;
} z;
Here, you can see I created two struct
s that are identical in their elements.
Why is it that when I try to assign x = z
it will generate a compile error but x = y
does not? They have the same contents, so why can't I assign them back and forth with each other, regardless?
Is there any way I can make this so I can assign x = z
? Or do they simply have to be the same struct
.
Can any C gurus point me in the right direction?