Posts

Showing posts from January, 2017

Chapter 7 : The C Preprocessor (Let us C)

Image
(a) Write down macro definitions for the following: 1. To test whether a character entered is a small case letter or not. 2. To test whether a character entered is a upper case letter or not. 3. To test whether a character is an alphabet or not. Make use of the macros you defined in (1) and (2) above. 4. To obtain the bigger of two numbers. // Let Us C (Chapter 7 : The C Preprocessor) : Program-1 /* Write down macro definitions for the following: 1. To test whether a character entered is a small case letter or not. 2. To test whether a character entered is a upper case letter or not. 3. To test whether a character is an alphabet or not. Make use of the macros you defined in (1) and (2) above. 4. To obtain the bigger of two numbers */ #include<stdio.h> #include<conio.h> #define SMALL(ch) ((ch>=97)&&(ch<=122)) #define CAP(ch) ((ch>=65) && (ch<=90)) #define ALPHA(ch) (SMALL(ch)||CAP(ch)) #define BIGGER(a,b) (a>b)?a:b void main() { unsigned i