main()
{
int x=20,y=35;
x = y++ + x++;
y = ++y + ++x;
printf("%d %d\n",x,y);
}
what is the output?
Answers were Sorted based on User's Feedback
Answer / fazlur rahaman naik
x = 57 and y = 94.
because the value of x = y++ + x++(35 + 20) is 55 and then
it incremented here x++ i.e.56 and the value of y = 36 and
then the value of y = ++y + ++x(57 + 37) = 94.
Is This Answer Correct ? | 37 Yes | 8 No |
Answer / manishsoni
here first in
x = y++ + x++;
x=35+20;
x=55;
then x is incresed by 1;
x=56;
y=36
y=++y + ++x;
y=++36 + ++56;
y=37+57;
y=94;
x=57;
now the value of x = 57.
therefore,after performing all operatioins we get,
x==57 And y==94....
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / sagar
here first in x = y++ + x++;
= (35+1) + (20+1);//here value of x is not
= 36 + 21; assigned to 21 as x++
= 57... and 'lly to y++....
now the value of x = 57.
now for y = ++y + ++x;
= (1+35) + (1+57);
= 36 + 58;
= 94...
therefore,after performing all operatioins we get,
x==57 And y==94....
Is This Answer Correct ? | 6 Yes | 4 No |
Answer / krzysztof
People... is itt really so hard to compile that and check? Correct answer, compiled with gcc:
56 93
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / yusuf
x++ means we have to assign the value and then the
increment comes to light.......so
x=y++ + x++;
=35 + 20;
=55
now the value of x=55 then
y=37 + 56;
=93
Is This Answer Correct ? | 2 Yes | 5 No |
Answer / c
x=y++ + x++;
here we should assign the value and then the increment
the value and the new value should be stored in a specified
variable....
here it is......
X= 35 (value=36 is stored in y) + 20 ( value=21
is stored in x);
X=55
NOw the value of x=55..and Y=36..the next expression
changes to like this...
Y= 37+56=93
Is This Answer Correct ? | 1 Yes | 4 No |
What are reserved words?
An entire structure variable can be assigned to another structure variable if __________
3 Answers Sasken, TCS, Tech Mahindra, Wipro,
hello friends what do u mean by BUS ERROR i got this error while i am doing my program in DATA STRUCTURES
Differentiate between null and void pointers.
To find whether a number is even or odd without using any conditional operator??
12 Answers College School Exams Tests, IBM,
write a c program for swapping two strings using pointer
How is actual parameter different from the formal parameter?
What are global variables?
can u write a program in C, which does not use = (eqaul)or any arithmatic assignment(like -=,+=,*= etc) operator to swap to number?
Why void is used in c?
What is unary operator?
what is the diff b/w static and non static variables in C. Give some examples plz.