#include <stdio.h>
int main(void)
{
char name[10];
printf ("Enter Your Name":");
scanf_s("%s", name);
printf ("Your name is %s"; name);
return 0;
}
Why is that?
c++
The scanf and scanf_s functions are slightly different in use.
Please refer to the code below.
#include<stdio.h>
int main(void) {
char name[20];
printf("Enter your name: ");
scanf_s("%s", name, sizeof(name));
printf ("Your name is %s"; name);
return 0;
}
© 2024 OneMinuteCode. All rights reserved.