Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!ginosko!usc!merlin.usc.edu!girtab.usc.edu!jeenglis From: jeenglis@girtab.usc.edu (Joe English) Newsgroups: comp.lang.c Subject: Re: Help... Message-ID: <5645@merlin.usc.edu> Date: 10 Oct 89 05:27:47 GMT References: <731@carroll1.UUCP> <39902@bu-cs.BU.EDU> Sender: news@merlin.usc.edu Reply-To: jeenglis@girtab.usc.edu (Joe English) Distribution: na Organization: University of Southern California, Los Angeles, CA Lines: 31 rang@cs.wisc.edu (Anton Rang) writes: >[ This is not a flame, just a clarification, OK? ] > >There is no difference between "char h[]" and "char *h" in a >declaration; they do exactly the same thing. This program fails >because there is no storage allocated for the string. To clarify your clarification, char h[] and char *h are different in some contexts. Most noticeably, /* in file foo.c */ char *h; /* in file bar.c */ extern char h[]; will break. char *h; says that the object stored at &h is a pointer to char(s). char h[]; says that the object stored at &h is itself a char (or vector thereof). In the declaration of a function argument, they are indeed the same, but as a local variable they are not. (Is 'char h[]' as a local variable even legal? If so, what does it mean?) --Joe English jeenglis@nunki.usc.edu