home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!ocsmd!ted
- From: ted@ocsmd.ocs.com (Ted Scott)
- Subject: Re: Where are literals stored?
- Message-ID: <By0vzy.4Ly@ocsmd.ocs.com>
- Sender: news@ocsmd.ocs.com
- Organization: Online Computer Systems, Inc. Germantown, Md., 20874
- X-Newsreader: Tin 1.1 PL5
- References: <27542@dog.ee.lbl.gov>
- Date: Fri, 20 Nov 1992 16:19:08 GMT
- Lines: 40
-
- Chris Torek (torek@horse.ee.lbl.gov) wrote:
- : In article <1992Nov18.233739.2335@den.mmc.com>
- : richard@crowded-house.den.mmc.com (Richard Armstrong) writes:
- : >For instance, is the string a stored in the same place in the following
- : >two declarations?:
- : >static char a[]="ABC"
- : >funca()
- : >{
- : >char a[]="ABC";
- : >}
- :
- : Neither of these is in fact a `string literal': in both cases the
- : quoted strings are initializers for objects. String literals are
- : formed from quoted strings that appear in a value context, e.g.,
- : char *p, *q;
- : p = "ABC";
- : q = "ABC";
- :
- : /* it is unspecified whether p == q */
- :
- : Distinct objects, however, always compare unequal, thus the following
- : strictly conformant program must print `0':
- :
- Ok, *I'm* confused here. Does this mean that if I do something like:
-
- *p[1] = ' ';
-
- q will now point to "A C" ??
- or will the above assignment yield a SEGV?
- or what? (I know probably what :)
-
- To carry this on further, what if p and q are in different scope, but the
- same source file?
-
-
- --
-
- -Ted Scott
- tscott@ocsmd.ocs.com I was told that I'm a P.C. person:
- (301) 601-2252 Politically Challenged, that is.
-