Define a macro to find maximum among of 3 given numbers using # ifdef, # else

Advertisement

Define a macro to find maximum among of 3 given numbers using # ifdef, # else.

Ans.

#ifdef
The syntax is as follows:
#ifdef IDENTIFIER_NAME
{
statements;
}
This will accept a name as an argument, and returns true if the name has a current definition. The name may be defined using a # define, the -d option of the compiler, or certain names which are automatically defined by the UNIX environment. If the identifier is defined then the statements below #ifdef will be executed

#else
The syntax is as follows:
 #else
{
statements;
}
#else is optional and ends the block started with #ifdef. It is used to create a 2 way optional selection. If the identifier is not defined then the statements below #else will be executed.


#endif
 Ends the block started by #ifdef or #else. 

Where the #ifdef is true, statements between it and a following #else or #endif are included in the program. Where it is false, and there is a following #else, statements between the #else and the following #endif are included. Let us look into the illustrative example given below to get an idea.
You Can Sale and Purchaser Solved Assignment Contact us:- ignouassignmentguru@gmail.com
Previous
Next Post »
Thanks for your comment