#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
Answer / jason
The answer is undefined. It is undefined in C to use the
increment operator more than once in the same expression.
MAX(i++, ++j) expands to:
(i++) > (++j) ? (i++) : (++j)
Which guarantees that either i++ or ++j appears twice in the
expression.
http://blog.emptycrate.com/node/329
| Is This Answer Correct ? | 7 Yes | 8 No |
What is the difference function call by value & function call by reference?
what is the little endian and big endian?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
What is a structure and why it is used?
how to print 2-D array using a single for loop?
2 Answers Mind Tree, TCS, Value Labs,
Are there any problems with performing mathematical operations on different variable types?
What is the benefit of using an enum rather than a #define constant?
Tell us two differences between new () and malloc ()?
How can I make it pause before closing the program output window?
What are the types of variables in c?
how to find anagram without using string functions using only loops in c programming
Explain what is the most efficient way to store flag values?