Why NULL is 0

Frank Adams franka at mmintl.UUCP
Fri Mar 18 01:46:18 AEST 1988


In article <800 at zippy.eecs.umich.edu> janc at palam.eecs.umich.edu (Jan Wolter) writes:
>As I read K&R, a null pointer is only produced when a *constant* 0 is assigned
>to a pointer.  When an integer is assigned to a zero, K&R seems to suggest
>that a bitwise copy is done, which may not be the same thing at all.  This
>seems to be the only case in C where "a=(b=c)" is not equivalent to "a=c,b=c".

It isn't.  Try:

double d;
int i;
d = (i = 1.5);

In general, "a=(b=c)" is eqivalent to "b=c,a=b".
-- 

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108



More information about the Comp.lang.c mailing list