#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 / 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 |
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 |
who is the founder of c
19 Answers College School Exams Tests, HP,
int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain me output????
what is difference between ANSI structure and C99 Structure?
sir i wanted to know how we wap in c to add numbers without using arithmetic operator in which digits are entered by user?
What is data structure in c and its types?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
By using C language input a date into it and if it is right?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is the explanation for prototype function in c?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
Distinguish between actual and formal arguments.
wap to print "hello world" without using the main function.