Copying Structures

alyce at itsgw.UUCP alyce at itsgw.UUCP
Wed Feb 25 04:51:58 AEST 1987


In article <4741 at ut-ngp.UUCP>, jjr at ut-ngp.UUCP (Jeff Rodriguez) writes:
[ For
	struct {float foo[100], bar[100];} 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?
Structure assignment is relatively new (Sys V or maybe even SVR2
on AT&T UNIX -- don't know about Berkeley), so don't count on it
being at all portable!

Alyce Faulstich
...!seismo!rpicsv!rpitsgw!alyce
alyce at itsgw.rpi.edu



More information about the Comp.lang.c mailing list