#define CUBE(x) (x*x*x)
main()
{ int a,b=3;
a=cube(b++);
printf("%d %d",a,b);
}
What should be the value of a and b? My calc a=4 but syst
a=6 how pls tell me if you know it?

Answer Posted / maitri

Couple of things:
a. macro is expanded as (x++ * x++ * x++)
b. what we have here is a postfix operator

so a = CUBE(3)=3*3*3
and b = 6 (incremented thrice)

Is This Answer Correct ?    53 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stl in c++ with example?

637


What is stl in oop?

681


What two types of containers does the stl provide?

573


Is there any error below, its a code to delete all entires from a map #include #include iostream.h int main() { int i =0; map TestMap; while(i<3) { TesMap.insert(TestMap::value_type(i,Test)); i++; } typedef map :: iterator mapIter =TestMap.begin(); if(mapIter!=TestMap.end()) { TestMap.erase(mapItrer); ++mapIter; } return 0; }

1896


How connect plc and pc through software

1923






write a program to convert a decimal number in to its equivalent binary number?

2084


What do stl stand for?

645


Explain stl.

907


how to making game in c++ ?

2183


how to use C++?

2067


Is string part of stl?

681


What does stl stand for in basketball?

649


What are the various types of stl containers?

738


What are the different types of stl containers?

652


What are stl algorithms?

627