Find the output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Find the output

#include<stdio.h> int main() {     int a, b = 10;     a = -b--;     printf("a = %d, b = %d", a, b);     return 0; }

13th Jun 2018, 12:45 PM
RAVI RANJAN
RAVI RANJAN - avatar
2 Answers
+ 6
Just use the sololearn's Code Playground to get the output.
13th Jun 2018, 12:56 PM
Akash Pal
Akash Pal - avatar
+ 4
In case you already know the output but you are just confused about it: b-- is postdecrement, i.e. at first the negative value of b is assigned to a and afterwards b is decremented if it was a = -(--b) the output for a would be -9
13th Jun 2018, 1:00 PM
Matthias
Matthias - avatar