C语言Visual Stdiuo字符串输入异常
#include <stdio.h>
int main() {
char c[6];
scanf_s("%s", c);
printf("%s", c);
}
输入:china
引发异常:0x0FA9E63C (ucrtbased.dll)处(位于 字符串.exe 中)引发的异常: 0xC0000005: 写入位置 0x00700000 时发生访问冲突。
C语言Visual Stdiuo字符串输入异常
#include <stdio.h>
int main() {
char c[6];
scanf_s("%s", c);
printf("%s", c);
}
输入:china
引发异常:0x0FA9E63C (ucrtbased.dll)处(位于 字符串.exe 中)引发的异常: 0xC0000005: 写入位置 0x00700000 时发生访问冲突。
收起
scanf_s的调用问题,scanf_s输入字符串时要带缓冲区大小参数,即
char c[6];
scanf_s("%s",c,6);
printf("%s",c);
报告相同问题?