Wednesday, July 6, 2011

C Progran to illustrate the use Of Macros

#include<stdio.h>
#define ISLOWER(c) (c>=97&&c<=122)
#define ISUPPER(c) (c>=65&&c<=90)
#define ISALPHA(c) ISLOWER(c) || ISUPPER(c)

int main()

{
char chr;

printf("Enter a character:\n");

scanf("%c",&chr);

if (ISALPHA(chr) )

{
printf("%c is an alphabetical character.\n",chr);
}
else
{
printf("%c is not an alphabetical character.\n",chr);
}

return 0;

}

No comments:

Post a Comment