Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

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 6 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

x=57
y=94

 Is This Answer Correct ? 14 Yes 4 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

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 ? 5 Yes 1 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

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

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

x=57
y=94

 Is This Answer Correct ? 4 Yes 3 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

People... is itt really so hard to compile that and check? Correct answer, compiled with gcc:
56 93

 Is This Answer Correct ? 0 Yes 0 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

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 4 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

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

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

x=57
y=95

 Is This Answer Correct ? 9 Yes 14 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

55 59

 Is This Answer Correct ? 3 Yes 22 No

More C Interview Questions

How we can set and clear bit in a byte using macro function?

related to rdbms query .

Define macros.

What are header files? What are their uses?

print pattern 1 1 33 33 555 555 77777777 555 555 33 33 1 1

1.)how to find d most repeated word in a string? string ="how do you do"?? output should be do

The difference between printf and fprintf is ?

what does keyword ‘extern’ mean in a function declaration?

long int size a) 4 bytes b) 2 bytes c) compiler dependent d) 8 bytes

What does main () mean in c?

what is the output of the below code? main( ) { printf ( "\nOnly stupids use C?" ) ; display( ) ; } display( ) { printf ( "\nFools too use C!" ) ; main( ) ; }

What is floating point constants?

Categories
• C (4668)
• C++ (3542)
• VC++ (653)
• Delphi (566)
• Python Related (3238)
• PHP Related (7341)
• Scala (340)
• R Programming (396)
• Kotlin (184)
• Apache Groovy (39)
• Ruby (245)
• Go Programming Language (139)
• Objective-C (429)
• Programming Languages AllOther (736)