Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!ll-xn!ames!xanth!kyle
From: kyle@xanth.UUCP (Kyle Jones)
Newsgroups: comp.lang.c
Subject: Re: Passing (char *) NULL to printf to match %s
Message-ID: <1686@xanth.UUCP>
Date: Sat, 25-Jul-87 13:28:55 EDT
Article-I.D.: xanth.1686
Posted: Sat Jul 25 13:28:55 1987
Date-Received: Sun, 26-Jul-87 02:45:56 EDT
References: <166@qetzal.UUCP> <157@hobbes.UUCP> <875@bsu-cs.UUCP>
Lines: 14

First:

#define NULL 0

Well the answer to this one seems simple enough.  For each %s that appears in
the printf() conversion string, a matching argument that is a pointer to an
array of charaters should be provided.  While (char *) NULL is a pointer that
is the same size as any other character pointer, it cannot point to an array
of characters in a valid C implementation.

Therefore if you pass (char *) NULL to printf(), you are giving it an invalid
argument.  What's stored at location 0 has nothing to do with this.  In C
(object *) NULL simply cannot point to any object.  This is because (object *)
NULL must remain "distinguishable from a pointer to any object." K&R p. 192