weeeeee thanks for that very well explained i really appreciate your help now i know how to use fgets. So fgets() function takes three arguments if im not mistaken first is the char * then the second is an int[number of characters] then the standard input or stdin please correct me if im wrong so i will know.....about scanf when using arrays i will not include & anymore ....thanks for that great help citizen...btw can i put anything else instead of stdin as the third argument??
Code:
#include <stdio.h>
int main(void)
{
char name1[15], name2[15], pass1[15], pass2[15];
printf("input username: ");
fgets(name1, 15, stdin);
printf("input password: ");
fgets(pass1, 15, stdin);
puts("registration successful");
printf("USERNAME: ");
fgets(name2, 15, stdin);
if(strcmp(name1, name2)==0)
{
puts("good now input your password");
}
else
{
printf("badbye\n");
return 1;
}
printf("PASSWORD: ");
fgets(pass2, 15, stdin);
if(strcmp(pass1, pass2)==0){
puts("logging in successful");
}
else
{
puts("wrong password");
}
return 0;
}
another problem i really dont know how to use getchar() to pause at the end any idea or example????