From: G DOT DegliEsposti AT ads DOT it To: "Greg Bell" cc: djgpp AT delorie DOT com Message-ID: Date: Thu, 26 Mar 1998 11:31:27 +0100 Subject: Re: C Newbie - Pointers to Structures Problem Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Precedence: bulk >void swap_points(POINTPTR a, POINTPTR b) //Assign pointer types to a & b >{ > POINTPTR temp; //Create a temporary address holder > temp->x = a->x; //Shift point a to temp > temp->y = a->y; You can't do this: temp doesn't point to anything, or better it points to some invalid area. While TC doesnt' complain about this, DJGPP detects an access to invalid memory and stops the program. Under TC you were lucky it didn't touch some important areas of memory, leading to some not obvious malfunction. If you do like this the space is allocated on the stack, and your program shouldn't crash anymore: (at least in this place :-) POINT temp; //Create a temporary address holder temp.x = a->x; //Shift point a to temp temp.y = a->y; // and so on... BTW. the ANSI standard for C requires main to return int and not void. ciao Giacomo