#define MAX(x,y) (x) > (y) ? (x) : (y)
main()
{
int i = 10, j = 5, k = 0;
k = MAX(i++, ++j);
printf("%d %d %d", i,j,k);
}

what will the values of i , j and k?
}

Answers were Sorted based on User's Feedback



#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / guest

12 6 11

Is This Answer Correct ?    70 Yes 32 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / vidyullatha

In Linux:
O/P: 12 6 11

Explanation:
when k = MAX(i++,++j) is called the macro is replaced and
evaluated as, (i++) > (++j) i.e 11 > 6. As the result of
the statement is true, it executes the statement ? (X) i.e
(i++) on total the statement looks like this
(i++) > (++j) ? (i++)
i.e 11 > 6 ? (i++)
i.e k = i++;
Here as i is post increment first value of i is assigned to
k and then it is incremented.
Hence k = 11.
as i is incremented twice it value is 12
and j is incremented once hence 6
So final O/P is 12 6 11.

Hope this helps.

Is This Answer Correct ?    35 Yes 2 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / sumi

11 , 6, 10

Is This Answer Correct ?    54 Yes 32 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / sshireesha

12 6 11

Is This Answer Correct ?    30 Yes 9 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / vignesh1988i

i=12
j=6
k=11

Is This Answer Correct ?    22 Yes 5 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / vignesh1988i

i=12
j=6
k=11

Is This Answer Correct ?    20 Yes 10 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / amit kumar ram

i=11, j=6 , k=10.

bcoz i=10 and j=6 pass to function
then check and give k=x which is k=10
then increament i by 1 i.e i=11.

Is This Answer Correct ?    20 Yes 12 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / mukul

ans : 11 6 0

Is This Answer Correct ?    3 Yes 2 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / amitesh

i=11 j=6 k=10

Is This Answer Correct ?    9 Yes 9 No

#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++..

Answer / pawan

10 5 0

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Program to find the sum of digits of a given number until the sum becomes a single digit

8 Answers   InterGraph,


what is the benefit of c30

2 Answers  


what is the hardware model of CFG( context free grammar)

0 Answers   Microsoft,


what is the output for this question: main() { int i=1; printf("%d%d%d",i,i++,++i); }

9 Answers  


What are the different file extensions involved when programming in C?

0 Answers  






what is level of tree if leaf node is at level 4.please explain.

1 Answers   Wipro,


in a town the percentage of men is 52 the percentage of total literacy is 48 if total percentage of literate men is 35 of the total population write a program to find the total no of the literate men and women if the population of the town is 80000

3 Answers  


What is the code for 3 questions and answer check in VisualBasic.Net?

0 Answers   Infosys,


Juxtapose the use of override with new. What is shadowing?

1 Answers  


What is a loop?

0 Answers  


what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }

6 Answers   Microsoft,


What is the g value paradox?

0 Answers  


Categories