I
Ioannis Vranos
As far as I know calloc() sets all bits to zero when successful, and
memset(s, 0, n) does the same thing to the first n characters of s, by
zeroing the bytes as unsigned chars.
K&R2 updated with the errata, has an example on page 167
int *ip;
ip= calloc(n, sizeof(int));
Is this always guaranteed to work? As far as I know, an int with value 0
may not have all its bits to 0.
memset(s, 0, n) does the same thing to the first n characters of s, by
zeroing the bytes as unsigned chars.
K&R2 updated with the errata, has an example on page 167
int *ip;
ip= calloc(n, sizeof(int));
Is this always guaranteed to work? As far as I know, an int with value 0
may not have all its bits to 0.