Nesting of macros in c language with output.
How to write code for nesting of macros in c language.
By using if and else condition we can check whether entered value is alphabet or not.
simply by using ISALPHA Keyword.
ISALPHA will check about the alphabet or not.
include header ....
#define ISLOWER(c) (c>=97&&c<=122)
#define ISUPPER(c) (c>=65&&c<=90)
#define ISALPHA(c) ISLOWER(c) || ISUPPER(c)
int main() // starting of main
{
char chr;
printf("Enter a character:\n"); // taking value from user
scanf("%c",&chr);
if (ISALPHA(chr) ) // cheking condition
{
printf("%c is an alphabetical character.\n",chr);
}
else // going in else part
{
printf("%c is not an alphabetical character.\n",chr);
}
return 0;
}
0 comments: