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

What are the benefits of polymorphism?

843


Why is oop better than procedural?

796


What is the importance of oop?

826


Write a program to sort the number with different sorts in one program ??

2093


Prepare me a program for the animation of train

2204


How long to learn object oriented programming?

801


Why is polymorphism important in oop?

800


What do you mean by Encapsulation?

799


What are two types of polymorphism?

799


What is the purpose of enum?

759


What are the data types in oop?

811


Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.

1951


How does polymorphism work?

851


Why is abstraction used?

826


What is ambiguity in inheritance?

830