Date: Wed, 21 Mar 2001 11:11:31 +0530 (IST) From: Mridul Muralidharan To: sager+@andrew.cmu.edu cc: Djgpp mailing list Subject: Re: newbie error, or are my pointers fuxing In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk i tried the code that u mentioned and did not get any seg faults ! maybe , with some other string longer than 40 char's , u are getting this error :) Mridul Muralidharan S8 Electronics and Communication Regional Engineering College Calicut India ------------------------------------------------------------------------------ If the code and the comments disagree, then both are probably wrong. -- Norm Schryer All generalizations are false, including this one. -- Mark Twain /earth is 98% full ... please delete anyone you can. - fortune On Tue, 20 Mar 2001, James W Sager Iii wrote: > I had a problem earlier with pointers messing my game up. > > I'd send 1 adress to a function, but it'd recieve a different one. > Really weird stuff... > > Anyway, I was wondering: > > > void stupid_newbie function(char *c1) > { > char a[40]; > > strcpy(a,c1); > > cout< } > > If I pass: > > stupid_newbie_function("Hello."); > stupid_newbie_function("world."); > > It will type: Hello > then a Segfault pops up. > > if I do: > char b[40]; > strcpy(b,"Hello"); > stupid_newbie_function(b); > strcpy(b,"World"); > stupid_newbie_function(b); > > It gives me: > HelloWorld > > > So is this me being a stupid rusty programmer? > Or is it due to my program having a memory leak I still need to track down? > > > I haven't got back in my groove yet... still mega rusty > All I want to do is design games, I hate code. > > > Thanks for reading, > James Sager >