Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!rutgers!mcnc!uvaarpa!murdoch!murdoch.acc.virginia.edu!aj3u From: aj3u@wilbury.ra.cs.virginia.edu (Asim Jalis) Newsgroups: comp.lang.c Subject: Is simple assignment allowed with structs Message-ID: Date: 30 Mar 91 21:12:51 GMT Sender: usenet@murdoch.acc.Virginia.EDU Followup-To: comp.lang.c Distribution: na Organization: University of Virginia, Charlottesville, VA 22903 Lines: 23 My compiler accepts the following program: struct s { int x; int y } a,b; main() { a.x = 10 ; a.y = 29; print(a);print(b); b = a; print(a);print(b); a.x = 200 ; a.y = 34; print(a);print(b); } The assignment from all appearances seems to copy both the fields of a to b. My question is, is such assignment legal. Can I expect other compilers to support this? Or should I explicitly assign the fields to ensure portability. I tried adding two structs and that did not work. Comments? Suggestions?