S
subnet
Excuse me for the perhaps silly question, but is the following
permitted:
struct mystruct {
int f1;
int f2;
char f3;
float f4;
};
struct mystruct s1, s2;
s1.f1 = 10;
s1.f2 = 15;
s1.f3 = 'a';
s1.f4 = 5.5;
s2 = s1; /* or, if working with (struct mystruct *), even *s2 = *s1
*/
gcc does not warn about anything, and furthermore it seems to work
(ie, all the fields in s2 are copied correctly from s1), but this kind
of operation seems pretty new to me. Do the standards talk about this?
Thanks
permitted:
struct mystruct {
int f1;
int f2;
char f3;
float f4;
};
struct mystruct s1, s2;
s1.f1 = 10;
s1.f2 = 15;
s1.f3 = 'a';
s1.f4 = 5.5;
s2 = s1; /* or, if working with (struct mystruct *), even *s2 = *s1
*/
gcc does not warn about anything, and furthermore it seems to work
(ie, all the fields in s2 are copied correctly from s1), but this kind
of operation seems pretty new to me. Do the standards talk about this?
Thanks