Hi I have a question about subsequent code in C:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char name[10];
printf("Enter your name: \n");
scanf_s("%s", &name);
printf("Your name is: %s", name);
return 0;
}
It works perfectly using CodeBlocks, but using Microsoft Visual Studio 2015 it just doesn't work. This warning is always shown:
Warning C4473 'scanf_s' : not enough arguments passed for format string
Could you please give me a hint on what's going on?
NOTE: In Visual Studio I always use scanf_s instead of scanf.
scanf_s()is not a standard function and requires extra parameters. Read the documentation.namenot&nameto scan into.#define _CRT_SECURE_NO_WARNINGSbefore#include <stdio.h>and other 'include' files to disable deprecation and usescanf()normally.