我有一个char x[16]尚未初始化的,我需要测试是否分配了某些东西,x或者它是如何在运行时创建的。我该怎么做?谢谢
示例代码
int main(int argc, char** argv) {
char x[16];
//<other part of the code>
if(x is an empty char array (not assigned anything) then skip the next line) {
//blank
}else {
//<rest of the code>
}
return 0;}
PS:我试过了memchar(x, '\0', strlen(x)),但它不能按我的意愿工作if(x[0] == '\0'),if(!x[0])因为 char 数组默认不包含\0。