I'm studying C language, I ran these codes in Microsoft Visual Studio, but I got an access violation exception, Could you please help me find out the reason?
#include <stdio.h>
int main() {
char name[10];
printf("Enter your name\n");
scanf_s("%s", name);
printf("Welcome %s\n", name);
return 0;
}
I've looked for numerous solutions to this, however some are no effective. I tried removing the &
from the name
, but that didn't help.