我正在使用Visual Studio Enterprise 2015,我收到了这个错误:
Exception thrown at 0x00007FF8E19979A3 (ucrtbased.dll) in Assignment 1C.exe: 0xC0000005: Access violation writing location 0x0000008836510000....whenever我使用字符/字符串输入,以至于这个简单的程序:
#include <stdio.h>
#include <string.h>
int main() {
char name[40], chk;
printf("What is your name?");
scanf_s("%s", name);
chk = getchar();
return 0;
}仍然给我同样的错误。我不知道是什么导致了它,尽管我怀疑是我正在使用的库中的某个东西,还是实际的编译器?公开征求建议。
发布于 2015-11-02 16:11:57
参数的scanf_s()错误。
scanf_s("%s",名称,40);或scanf_s("%s",名称,_countof(名称));
https://stackoverflow.com/questions/33409308
复制相似问题