K
Keith Thompson
Régis Troadec said:"Keith Thompson" <[email protected]> a écrit dans le message de
[snipped]
On the other hand, if we want to allow for the possibility that the
declaration of p could be changed so it points to something bigger
than one byte (perhaps a wchar_t), we'd want to use:
p = malloc(len * (sizeof *p + 1));
to allocate one additional object rather than one additional byte.
I guess you meant p = malloc( (len+1)*sizeof*p ); to allocate one
additional object.
D'oh! Yes, you're right; sorry about that.