Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!rws From: rws@EXPO.LCS.MIT.EDU (Bob Scheifler) Newsgroups: comp.windows.x Subject: Re: stupid C question Message-ID: <8812311753.AA00790@EXPO.LCS.MIT.EDU> Date: 31 Dec 88 17:53:03 GMT References: <4543@xenna.Encore.COM> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 18 I'm pretty sure the confusion, if any, is some belief that strlen("abc") should return the same result as sizeof("abc") which is false. My confusion was more looking at K&R, p99, which says "the compiler terminates the array with the character \0 so that programs can find the end". It wasn't clear whether "terminates" meant that it was considered "inside" or "outside" the array. It goes on to say "The length in storage is thus one more than ..." But I noted that it was (careful/careless) to say "length in storage" rather than "length of the array". What's worse are compilers (known to exist!) which return sizeof(char *) for sizeof(string constant), that is unacceptable but worth a moment's thought when relying on these semantics or trying to track down a problem. I'm getting pretty tired of working around broken compilers ...