#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?

Answers were Sorted based on User's Feedback



#define CUBE(x) (x*x*x) main() { int a,b=3; a=cube(b++); printf("%d %d",a,b); } Wh..

Answer / vignesh1988i

surely 'a' cannot be 4 or 6.... it will be the value of b... since we are multiplying b++ thrice...... so surely 'a' cannot be 4 or 6.....

according to me b=6 , and a=60......


thank u

Is This Answer Correct ?    4 Yes 9 No

#define CUBE(x) (x*x*x) main() { int a,b=3; a=cube(b++); printf("%d %d",a,b); } Wh..

Answer / jesaul

The code will not compile. The macro is in wrong case.
After fixing that you would get 27 6

Is This Answer Correct ?    2 Yes 7 No

Post New Answer

More STL Interview Questions

What is 2*2?

7 Answers  


Give the output of the following program main() {char *p='a'; int *i=100/*p; } what will be the value of *i= 1

6 Answers   Sun Microsystems,


wap in c++ which accept a integer array and its size as argument and replaces element having even values with its half and element having odd values with twice its value

1 Answers  


Is stl open source?

0 Answers  


how to use C++?

0 Answers   NIIT,


what's the difference between function overloading and function overiding?

5 Answers  


Explain how to insert a hyperlink in to an Excel worksheet and save a Word document as a Web page.

1 Answers  


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

0 Answers  


What is the Difference between CArray and CList?

1 Answers   ProdEx Technologies, Siemens,


why does the execution of a c++ program start with main()???

11 Answers  


What Is Operator Overloading in C++?

3 Answers  


method overloading means what?

2 Answers   CTS,


Categories