#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
char *s;
printf("enter the string : ");
scanf("%s", s);
printf("you entered %s\n", s);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我提供长度不超过17个字符的小输入时(例如"aaaaaaaaaaaaaaa"),程序工作得非常好,但是在提供更大长度的输入时,它会给我一个运行时错误,说"main.c已经意外停止工作".
我的编译器(代码块)或我的电脑(Windows 7)有问题吗?或者它是否与C的输入缓冲区有关?
c ×1