www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/13/20:24:48

Date: Fri, 13 Mar 1998 17:24:16 -0800 (PST)
Message-Id: <199803140124.RAA06141@adit.ap.net>
Mime-Version: 1.0
To: "A. Jans-Beken" <jabe AT oce DOT nl>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: why don't this work

At 05:17  3/12/1998 GMT, A. Jans-Beken wrote:
>shifter wrote:
>> 
>> #include <stdio.h>
>> 
>> main()
>> {
>> char *i;
>> char *password;
>
>OOPS----^^^^^^^^
>password is a pointer but points to nothing.
>char *password = "xxxxxxxxxxxxxxxxxx"; works...

No it won't! You may get away with it on DJGPP, but on most systems a string
constant will be read-only. Setting a pointer to point to a constant and
then writing into it will get you only a nice message saying "Segmentation
fault".


Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019