calloc() 和 malloc() 的區別?


1
2
3
4
5
// calloc(m, n) 本質上等價於
// free() 可以安全地用來釋放 calloc() 分配的內存

p = malloc(m * n);
memset(p, 0, m * n);