C語言中,數組初始化為空的方法有兩種:
int arr[10] = {0};
上述代碼將創建一個包含10個元素的整型數組,并將所有元素初始化為0。
#include <string.h> int arr[10]; memset(arr, 0, sizeof(arr));