I write this program to cheak user name and password enter by the use is same then the user is able to login,
for this i declare a pointer array to store some user name and password (like sin up by user),and then the user enter her user name and password , i use string compare function to find the weather the enter username and password is correct
But at run time this code give an error
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main()
{
char *cUser[5],*cPassword[5],cLoginU[10],cLoginP[10];
int iCount=0,iUser,iPass;
do
{
printf("Enter the user name :");
scanf("%s",&cUser[iCount]);
printf("Enter the user password :");
scanf("%s",&cPassword[iCount]);
iCount++;
}while(iCount<5);
printf("\nEnter the username for login : ");
scanf("%s",&cLoginU);
printf("\nEnter the password for login : ");
scanf("%s",&cLoginP);
for(iCount=0;iCount<5;iCount++)
{
iUser=strcmpi(cUser[iCount],cLoginU);
if(iUser==0)
{
break;
}
}
for(iCount=0;iCount<5;iCount++)
{
iPass=strcmp(cPassword[iCount],cLoginP);
if(iPass==0)
{
break;
}
}
if(iUser==0 && iPass==0)
{
printf("\nYour Login successful");
}
else
printf("\nWrong username and password");
getchar();
return 0;
}