while(gets(a[n])!=NULL这个是什么意思,怎么结束循环的
#inclued<stdio.h>
int main()
{
char a[10][300]={0},*p;
int n=0;
while(gets(a[n])!=NULL){
n++;
}
p=find_max_string(a,n);
puts(p);
return 0;
}
while(gets(a[n])!=NULL){ n++; } 从键盘循环接收字符串,保存在a[n]为首地址的字符串内存空间,以回车做为结束符,读入成功,返回与参数 a[n] 相同的指针,同时n++; 为读入下一字符串做准备。读入过程中遇到EOF(文件结尾)或发生错误 返回 NULL指针,所以这里就以判断gets() 返回值为NULL时,认为输入结束,跳出 while() 循环,进入程序的下一代码执行。