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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

643


stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

1863


Explain setjmp()?

663


What is a macro in c preprocessor?

642


how can use subset in c program and give more example

1509






What is context in c?

547


Explain what is a 'locale'?

596


How do you do dynamic memory allocation in C applications?

636


In C programming, how do you insert quote characters (‘ and “) into the output screen?

904


In which header file is the null macro defined?

869


Explain how can I read and write comma-delimited text?

669


please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics

2874


What is a program flowchart and how does it help in writing a program?

676


Why is not a pointer null after calling free?

604


What is the purpose of clrscr () printf () and getch ()?

607