Message-ID: <35103FD5.A9F59A26@mail.ucsm.edu.pe> Date: Wed, 18 Mar 1998 16:42:49 -0500 From: rpinnell AT characato DOT ucsm DOT edu DOT pe Reply-To: rpinnell AT characato DOT ucsm DOT edu DOT pe MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Pointers and DJGPP Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Precedence: bulk Hi I have been trying to teach myself C for the last few months or so and have been using DJGPP. I seem to be having a lot of problems whenever I use pointers with DJGPP. Take the following example a simple strcat. #include void mstrcat(char *s,char *t); int main() { char ms1[]="Hello"; char ms2[]=" World"; mstrcat(ms1,ms2); printf("After mstrcat ms1 = %s\n",ms1); return 0; } void mstrcat(char *s,char *t) { while(*s++ != '\0') ; s--; while((*s++ = *t++) != '\0') ; } The program compiles fine and does what I want it to when it runs but exits with the following error message. Exiting due to signal SIGSEGV General Protection Fault at eip=000015dd eax=00000000 ebx=0004e100 ecx=00000000 edx=00000024 esi=00000054 edi=0000c4c0 ebp=6e6e6950 esp=0004c498 program=C:\WORK\A.EXE cs: sel=00af base=8327b000 limit=0005ffff ds: sel=00b7 base=8327b000 limit=0005ffff es: sel=00b7 base=8327b000 limit=0005ffff fs: sel=0087 base=00009930 limit=0000ffff gs: sel=00c7 base=00000000 limit=ffffffff ss: sel=00b7 base=8327b000 limit=0005ffff Call frame traceback EIPs: 0x000015dd Which is all Greek to me! It isnīt just this simple program that I have problems with I seem to get similar error messages whenever I pass pointers to a function. The same things work ok if I just use arrays rather than pointers. Any advice would be aprreciated. My apologies if this is the wrong place to ask this question but it seems to me it is more a DGJPP/DOS question that a general C one. Richard Pinnell Arequipa Peru