+ 1
Please heeeeelp
X=2 , y=4 Y*=2 X=y++ - ++y X++ Printf(x and y) What is x and y!!!?
10 Answers
+ 2
Actually:
x = undefined,
y = 6,
C is case-sensitive. That means X is not x. Y is not y.
^Kidding, but be careful all the same when posting code.
PS: printf("%d\n%d\n", x, y); is what you're looking for.
Ace Aren't mathematics pre-calculated and converted to literals where relevant values are known at compile-time by all compilers? Just curiosity, I'd still never rely on that behaviour.
+ 2
the first y++, means use the value of y, and THEN increment it by 1.
++y means increment it by 1, and THEN use it.
y=8 just before the x=y++ - ++y line.
That line with the y++ etc, therefore is really this:
x = value of y (but then increment y by 1) - (increment y by 1) value of y
x = 8 - 10 [and now y is 2 higher]
+ 2
nonzyro Definitely agree. That's why I said "if ignoring compilation errors" âș It's almost doable as some kind of C pseudo-code đ€đ
+ 2
Xan Actually it reminds me of a Natural Language dialect of Basic a friend proposed for teaching kids to program. I said stick to Lego.
+ 1
X=2 , y=4
Y*=2 // y=8
X=y++ - ++y // X=-2, y=10
X++ // X=-1
Printf(x and y)
What is x and y!!!?
x=-1
y=10
If ignoring compilation errors!
+ 1
I need to Know something when i delete x++ then x=-2 hoow
0
Thhhhhhhanks so freaking much
0
Yes I know this .. just it's the keyboard phone