My Code:
%{
#include<stdio.h>
int vowelcount=0;
int consocount=0;
%}
%%
"a"|"e"|"i"|"o"|"u"|"A"|"E"|"I"|"O"|"U" {vowelcount++;}
[a-zA-z] {consocount++;}
%%
int yywrap(){}
main()
{
printf("Enter a String:\n");
yylex();
printf("The number of Vowels in the string are: %d",vowelcount);
printf("The number of Consonants in the string are: %d",consocount);
return 0;
}
I'm only getting the access to enter a string. After that it's not printing my expected output of counting number of vowels and consonants. I think that I've written the code correct, but I have no clue why it's not working. Can you please take a look into it.