Are strings local?

Duke Robillard rgr at m10ux.UUCP
Sat Aug 6 02:31:51 AEST 1988


In article <370 at scotty.UUCP> jwr at scotty.UUCP (Jim Reid) writes:
)In article <652 at m10ux.UUCP) rgr at m10ux.UUCP (Duke Robillard) writes:
)<main() 
)<{
)<	char *p;
)<      /* or, if you'd like to be even more obscure... */
)<	(p= "def")[2]= 'x';
)<	printf("%s\n", p);   /* this will print "abx\n" */
                                                 ^^^typo
)<}

)I tried it on my system(SUN 3/75 with SUN UNIX 4.2 release 3.5) &
)got "dex" where you got "abx".

    My typo--"dex" is the weird thing I got, too.

    Like they same in /usr/games/fortune, "Make sure the comments
match the code."
-- 
+------
|       Duke Robillard 
|       AT&T Bell Labs           {backbone!}att!m10ux!rgr
|       Murray Hill, NJ          rgr at m10ux.ATT.COM



More information about the Comp.lang.c mailing list