This function or variable may be unsafe. Consider using scanf_s instead

vs2017 community
win10
代码:

#include <stdio.h>
int main() {
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", a + b);
    return 0;
}

错误:
C4996 ‘scanf’: This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

解决方法1:
scanf -> scanf_s
解决方法2:
_CRT_SECURE_NO_WARNINGS

see more

猜你喜欢

转载自blog.csdn.net/qq_35598978/article/details/80033523