📜  用 0 初始化 c 中的数组 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:36.309000             🧑  作者: Mango

代码示例1
static char ZEROARRAY[1024]; // if declaration is in global scope or is static it will alredy be initialized to Zeroes
// OR
char ZEROARRAY[1024] = {0}; // Compiler fills unwritten entries with zeroes
// OR
memset(ZEROARRAY, 0, 1024); // Alternatively you could use memset to initialize the array at program startup: