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

vs2017 community
win10
code:

#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.

Workaround 1:
scanf -> scanf_s
Workaround 2:
_CRT_SECURE_NO_WARNINGS

see more

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324580895&siteId=291194637