initializing null pointers
guy at gorodish.UUCP
guy at gorodish.UUCP
Thu Feb 5 15:37:11 AEST 1987
>What about pointer arrays allocated with calloc()? Does one have to
>initialize all the elements in a loop to be portable (despite the fact
>that it is unnecessary on most machines)? Evidently, yes.
Definitely yes. To quote from the ANSI C draft:
The "calloc" function allocates space for an array of "nmemb"
objects, each of whose size is "size". The space is
80
initialized to all bits zero.
...
80. Note that this need not be the same as the representation
of floating-point zero or a null pointer constant.
More information about the Comp.lang.c
mailing list