I need some help with one of the warnings I have been getting. My program compiles just fine, however, I get the following warning:
warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. . can someone please explain what difference does it make by including scanf_s vs. scanf?
Here my code:
#include <stdio.h>
int main(void)
{
int n=0;
int nO=0;
int nT=0;
int nTh=0;
int nF=0;
int nFi=0;
printf("Please enter a number :");
scanf("%d",&n);
nO = n/10000;
nT = (n % 10000) /1000;
nTh = (n % 1000) /100;
nF = (n % 100) /10;
nFi = n % 10;
printf("\n%4d%4d%4d%4d%4d\n", nO, nT, nTh, nF, nFi);
printf("\n%4d%4d%4d\n", nTh, nF, nFi);
printf("\n%4d%\n", nFi);
return 0;
}
I am using Microsoft Visual C++ 2008 expression edition.
This post has been edited by ClanguageLearner: 19 July 2009 - 09:03 PM

New Topic/Question
Reply



MultiQuote



|