C语言中,*s=✀尀0✀这样写对不对?另外 Int i=0 While(s[i]!=✀尀0✀)

2025-03-11 14:39:59
推荐回答(1个)
回答1:

如果s是一个char型指针,也即char *s; 则可以写成 *s='\0'
int i=0
while(s[i]!='\0')
i++;
是对的,如果while中还有其他语句,需要加{ }
也即
int i=0
while(s[i]!='\0')
{
i++;
}