Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ames!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpesoc1!hpindda!hpisoa2!jackg From: jackg@hpisoa2.HP.COM (Jack Gerson) Newsgroups: comp.unix.xenix Subject: Re: uPort 1.3 cc static char * Message-ID: <1120001@hpisoa2.HP.COM> Date: Tue, 17-Nov-87 18:17:15 EST Article-I.D.: hpisoa2.1120001 Posted: Tue Nov 17 18:17:15 1987 Date-Received: Sat, 21-Nov-87 11:11:42 EST References: <471@petro.UUCP> Organization: Hewlett Packard, Cupertino Lines: 32 > / hpisoa2:comp.unix.xenix / jrb@petro.UUCP (Jon Boede) / 5:51 am Nov 16, 1987 / > I sent some code over to an AT running Microport XENIX 1.3 ... when using the > -Ml (large) model the following crashed and burned... > > main() > { > char *a_pointer; > > a_pointer = "some static data"; > > puts(a_pointer); > } > > However, when I change a_pointer to "static char *a_pointer" it works. Why? > > Thanks, > Jon > -- > Jon Boede ...!{gatech,ihnp4,ssbn,swrinde,tness1,utanes}!petro!jrb > 512/599-1847 2555 N.E. Loop 410, #1403, 78217 > "People who are incapable of making decisions are > the ones who hit those barrels at freeway exits." > ---------- You didn't allocate memory for your character array, so it's no surprise your process crashed. How did you do the static allocation? If you said static char *a_pointer = "some static data" your declaration itself allocated space for the array.