Is there an issue with structure assignment or am I doing something really dumb? The following program produces the output 22 23 24 0 0 0 rather than 22 23 24 22 23 24 as I would have expected. I am using 2.12.0 on an Atari platform. #include <stdio.h> #include <stdlib.h> struct point_struct { unsigned char x; unsigned char y; }; struct rectangle_struct { struct point_struct p1; struct point_struct p2; unsigned char width; unsigned char height; }; struct rectangle_struct r1; struct rectangle_struct r2; void copy_rect( struct rectangle_struct *r ) { r2=*r; } void main(void ) { r1.p1.x=22; r1.p2.x=23; r1.height=24; copy_rect(&r1); printf("%i %i %i\n",r1.p1.x,r1.p2.x,r1.height); printf("%i %i %i\n",r2.p1.x,r2.p2.x,r2.height); } ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Fri May 15 16:08:44 2009
This archive was generated by hypermail 2.1.8 : 2009-05-15 16:08:47 CEST