Hey guys. I need to do an e-mail scan with these features.
Email must have: 3 characters or more; an at sign ("); other 3 characters or more; followed by an endpoint (.) signal; and a set of at least 2 characters.
What I did was this, but it is jumping some conditions.
main(){
int x;
char email[50]={"[email protected]"};
int arroba,ponto,passa,maior,c_P,c_S,i;
int tam=strlen(email);
char teste='.';
for (i = 0; i < tam; i++) {
if(email[i] > 3){
maior=1;
}if(email[i] == '@'){
arroba=1;
}if(arroba == 1 && email[i] >= 3){
c_P=1;
}if(email[i]=='.'){
ponto=1;
}if(ponto=1 && email[i] >=2){
c_S=1;
}
if(maior==1 && arroba == 1 && c_P==1 && c_S ==1){
passa=1;
}else{
passa=0;
}
}
if(passa==1){
printf("Valido");
}else{
printf("Invalido");
}
}