#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 ?    52 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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; }

1877


What is the stl, standard template library?

585


What is a stl vector?

619


What is a standard template library (stl)?

632


a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.

1366






What are the various types of stl containers?

718


What are the components of stl?

611


Who wrote stl?

665


help me i need a c++ program which takes sequesnce of characters and outputed sequence of their token taypes, work same compiler in lexical analysis phase

1873


What is a list in c++ stl?

684


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1965


Describe the My Computer and My Documents folders; identify the elements that are present in every Window.

1845


What are stl algorithms?

612


Is string part of stl?

668


How stl is different from the c++ standard library?

633