Chapter - 8: The C Preprocessor

Write down macro definition for the following:


C
Sections
2
Exercises

1. To check whether a character is lower case letter or not
#define LOWER (alpha>=97 && alpha<=122)

 

2. To check whether a character is upper case letter or not 
#define UPPER (alpha>=65 && alpha<=90)

 

3. To check whether a character is an alphabet or not. Make use of the macros you defined in 1 and 2 above.
#define UPPER (alpha>=65 && alpha<=90)
#define LOWER (alpha>=97 && alpha<=122)
#define YES (UPPER || LOWER)

 

4. To obtain the bigger of two numbers
#define MAX(a,b) ((a>b)?a:b)


© 2021 Garbage Valuegarbage value logo