Friday, April 12, 2019

lex program to identify the word and change the case of each character of word (i.e if character in word is in lowercase then convert it to uppercase and if it is uppercase then convert to lowercase)


%{
     #include<stdio.h>
%}
%%
[a-z] printf("%c",yytext[0]-32);
[A-Z] printf("%c",yytext[0]+32);
%%
int main()
{
     printf("Enter Input::");
     yylex();                 
}

ScreenShot:

No comments:

Post a Comment