BSD bzero() & NULL

Jay Laefer jl57+ at andrew.cmu.edu
Thu Nov 15 01:45:28 AEST 1990


[I'm asking the following in the context of ANSI C.]

I'm confused on an issue regargding NULL and the BSD function bzero().

I realize that the following assignments are equal:

char *fred;

fred = 0;
fred = (char *)NULL;

because the compiler is responsible for translating the zero bit pattern
into its internal representation of NULL.

But, given that bzero() directly fills an area with zeros, can I assume
that the following is equivalent to the above?

bzero(fred, sizeof (char *))

My gut reaction is no because this zeros out a block of memory and I'm
not guaranteed that the computer's internal representation of NULL is a
zero bit pattern.

Answers, anyone?



More information about the Comp.lang.c mailing list