char *Foo VS. char Bar[]
Ken Arromdee
arrom at aplcen.apl.jhu.edu
Sat Apr 15 04:04:17 AEST 1989
Modifying a string literal is legal in pre-ANSI versions of C and not
necessarily so in ANSI versions. Thus, neither MSC nor gcc was wrong.
Source: K&RII, page 194.
char *foo=" " is a pointer to a string literal. char bar[size]=" " is an
array, which gets initialized to the requested contents.
--
EARTH | --Kenneth Arromdee
smog | bricks | UUCP: ....!jhunix!ins_akaa
AIR mud FIRE| INTERNET: arromdee at crabcake.cs.jhu.edu
soda water | tequila | BITNET: g49i0188 at jhuvm
WATER |(please, no mail to arrom at aplcen)
Element chart from "Science Made Stupid". (The chart seems rather popular...)
More information about the Comp.lang.c
mailing list