Date: Wed, 12 Aug 1998 11:30:59 +0300 (IDT) From: Eli Zaretskii To: Cephaler cc: djgpp AT delorie DOT com Subject: Re: pointers and errors make cephaler go crazy In-Reply-To: <01bdc535$858a16c0$0100007f@scully> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 11 Aug 1998, Cephaler wrote: > still doesn't work, not it's a sigsegv, and rhide is pointing at a > perfectly legitimate line of code.. > > blit(tiles[map[x][y]->tile],screen,0,0,x*32,y*32,32,32) Please always post the traceback printed when it crashes. The most probable cause of the crash is that either map[x][y]->tile is garbled, or tiles[] is garbled or a NULL pointer. Is map[x][y]->tile really an index? You didn't tell, but it could be that map[x][y]->tile is already a pointer to the tile, so you don't need to index tiles[] with it. > so I changed it > > blit(tiles[&map[x][y]->tile],screen,0,0,x*32,y*32,32,32) This will never work. You are using a pointer (an address of map[x][y]->tile) as an index into an array. > typedef struct { > unsigned char tile,tag; > } _tile; It is usually a bad idea to use names with leading underscores. ANSI C says that these names are reserved for the library, so you could get a conflict.