C语言的gets()问题!

C语言 码拜 9年前 (2015-11-16) 1251次浏览
C语言的gets()问题![color=#00FF00]int main()
{
int i = 0;
char max[10];
char *p = max;
puts(“Please enter 10 strings”);
while (i< 10)
{
printf(“max [%d] = Continue input: “,i);
gets(p+i++);
}
return 0;
}
为什么输入 最后的时候(max[9]的时候 回车 VS报错.表示不理解,求高手指点下!谢谢!);
解决方案:40分
//1个长度为N的字符串a_str是N+1个字符的数组
char a_str[N+1];
//10个长度为N的字符串ten_str是10个(N+1个字符的数组)组成的数组
char ten_str[10][N+1];

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明C语言的gets()问题!
喜欢 (0)
[1034331897@qq.com]
分享 (0)