Chapter - 8: The C Preprocessor

Write down macro definition for the following:


C
Sections
2
Exercises

A

B

C

1

2

3

4

5

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)


© 2020 Garbage Valuegarbage value logo