c语言中\0怎么处理?

来源:百度知道 编辑:UC知道 时间:2024/06/04 06:19:38
当一个字符性的指针变量p指向一个字符串时(假设是"student"),那么*P=‘\0'这种形式存在吗??

存在

字符串结束

#include <stdio.h>

int main()
{
char *p = "";

if (p[0] == '\0') //
{
printf("存在!!!\n");
}
else
{
printf("不存在!!!\n");
}
return 0;
}

有这种形式存在的。
加'\0'表示字符串结束。

存在啊,它贝约定为字符串结束符