void loginForm() {
char username[100], password[100];
printf("Username: ");
scanf("%[^\n]", username);
printf("%s", username);
printf("Password: ");
scanf("%[^\n]", password);
printf("%s", password);
}
I've been experiencing issues with this code in VS2015, where everytime I input my username it just goes on havoc, like this:
Username: Tenzo
Password: Tenzo╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠Tenzo
I'm confused since in the code, I want to print the "Username" first before asking the user to input their password, but as you can see, I haven't even typed anything to the password but as you can see it already looked like that. Tested the code on VS2010 and everything is working just fine. I don't know what is happening.
NB: The code is written in C, not C++.