Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: NULL as a string terminator Message-ID: Date: 10 Aug 90 15:00:52 GMT References: <1990Aug7.210152.7586@arcturus.uucp> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 24 In-reply-to: evil@arcturus.uucp's message of 7 Aug 90 21:01:52 GMT In article <1990Aug7.210152.7586@arcturus.uucp> evil@arcturus.uucp (Wade Guthrie) writes: | Gary Duzan writes: | >=> char command[15]; | >=> command[strlen(command)-1]=NULL; /* chop off the \n */ | | and Doug Gwyn says: | > You're correct; the example code would happen to work with the traditional | > definition of NULL as plain 0, but not if it's defined as ((void*)0). | | That is why I have made it a practice to define a macro: | | #define NULLchar '\0' I really don't understand why the NULLchar macro is any clearer than just '\0'. But then, I really have never seen the need for NULL either (the appropriate cast of 0 works just as well -- if you have problems with the shift key, then maybe you should learn to type :-) -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 Do apple growers tell their kids money doesn't grow on bushes?