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 is overloading in oops?

598


What is the problem with multiple inheritance?

586


Explain the advantages of inheritance.

675


What is the important feature of inheritance?

635


What is a null tree?

632






String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?

1944


What is the example of polymorphism?

560


What is an example of genetic polymorphism?

651


Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.

699


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1148


What is encapsulation in ict?

608


What is difference between multiple inheritance and multilevel inheritance?

603


What is the purpose of enum?

583


What are classes oop?

598


How to call a non virtual function in the derived class by using base class pointer

5272