How can we use the preprocessor #if and #elseif.

Answer Posted / som shekhar

Take the following example where i assume that table size
has been defined previosly but at some part of time i want
to change it..but the table size is defined in some other
module and you dont have an access to it.

#if TABLE_SIZE>200
#undef TABLE_SIZE
#define TABLE_SIZE 200

#elif TABLE_SIZE<50
#undef TABLE_SIZE
#define TABLE_SIZE 50

#else
#undef TABLE_SIZE
#define TABLE_SIZE 100
#endif

int table[TABLE_SIZE];

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to hide the base class functionality in Inheritance?

650


What are the components of marker interface?

614


What is solid in oops?

622


What is methods in oop?

561


What is polymorphism explain?

702






Why is static class not inherited?

604


What is destructor give example?

612


• What are the desirable attributes for memory managment?

1737


How does polymorphism work?

643


write a program to find 2^n+1 ?

1561


What is polymorphism explain its types?

694


Why is oop better than procedural?

614


What exactly is polymorphism?

616


Can a destructor be called directly?

613


Can we override main method?

613