scanf() is likely to cause misbehavior due to programmer error. This can be used as a means of executing the desired command by an attacker and is vulnerable to security.
Therefore, Visual Studio strongly recommends that you use scanf_s() instead of allowing scanf()
by default.
If you want to use scanf()
as in the error message in C4996, you can define _CRT_SECURE_NO_WARNINGS
at the top, or define the preprocessing macro in the project property as follows:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
//..
If you want to use scanf_s()
for this, you can write it as follows:
scanf_s("%d", &ysalary);
© 2024 OneMinuteCode. All rights reserved.