Friday, April 12, 2019

Lex program to validate mobile number. (i.e Number having length of 10 is valid)


%{
#include<stdio.h>
%}
%%
[0-9]{10} {printf("valid");}
.* {printf("invalid");}
%%
main()
{
printf("Enter a no : ");
yylex();
}


ScreenShot:

No comments:

Post a Comment