Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!husc6!encore!zelig!jdarcy From: jdarcy@encore.com (Jeff d'Arcy) Newsgroups: comp.lang.c Subject: Re: Difference between "char *arr" and "char arr[]" Message-ID: Date: 22 Sep 90 18:58:44 GMT References: <8103@aggie.ucdavis.edu> <1990Sep22.130345.15450@virtech.uucp> Sender: news@Encore.COM Lines: 19 In case nobody else has mentioned it (I came in late on this one), there is a difference between *x and x[] besides allocation and semantics for globals: sizeof(). A lot of times I've been tempted to write static char *message = "hello"; /* ... */ write(fd,message,sizeof(message)); within a routine. Obviously this won't work, but static char message[] = "hello"; will. It's amazing how easy it is to forget this little detail and how many times I've seen it done. Usuaully it's much more insidious than this example. -- Jeff d'Arcy, Generic Software Engineer - jdarcy@encore.com Nothing was ever achieved by accepting reality