I have just started learning C programming and I am pretty new to it. I want to develop a habit of writing clean and readable code so that others can understand my code well. I have written this program of alphanumPass, just want to know how the code looks, is it good? if not what should I focus on more?
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include<string.h>
int main()
{
char pass[20]; //Declaring the array to store pass
int i,flag1=0, flag2=0, flag3=0;
printf("Please enter a password having a Upper case letter, a number and also a $ sign \n");
scanf("%s",&pass);
{
for(i=0;i<=strlen(pass);i++)
if( isupper(pass[i]) )
flag1=1;
else if(isdigit(pass[i])) //Loop to check if all element in pass has a digit, alpha & '$'
flag2=1;
else if(pass[i]=='$')
flag3=1;
}
{
if((flag1==1) && (flag2==1) && (flag3==1)) //All condition true
{
printf("\nNice Password!");
}
else
{
printf("\nPassword must contain a upper case letter, a number and a $ sign"); //Something missing
}
}
return 0;
}