4 ms·
>Why can't we wait and let that be the first value that's actually meaningful instead of wasting time writing 0's Because we might want to read from it before
by jolux 4y ago
>Why can't we wait and let that be the first value that's actually meaningful instead of wasting time writing 0's
Because we might want to read from it before we write to it. The simplest case is an array: unless we ensure that we write to every index before we read from it, we risk reading out (potentially sensitive) garbage data if we didn't calloc it.