Copying Structures

jjr at ut-ngp.UUCP jjr at ut-ngp.UUCP
Sat Feb 21 12:51:17 AEST 1987


Consider
     typedef struct { float foo[100], bar[100]; } mytype;
     mytype x, y;
I have found that
     y = x;
does the same thing as
     for(i = 0; i < 100; i++) 
     { y.foo[i] = x.foo[i]; y.bar[i] = x.bar[i]; }
Is this shortcut portable?  Does the ANSI standard allow it?

                           Jeff Rodriguez
                           jjr at ngp.utexas.edu



More information about the Comp.lang.c mailing list