it is a silly Q for most of u - i know - but i one of the beginner here, and I can not understand why the output in here are 12 what does this (x--) do to the resu
-- is the 'decrement' operator. It simply means that the variable it operates on (in this case the x variable) gets is decremented by 1.
Basically it is shorthand for :
x = x - 1;
So what the code does :
int x,y ; # Define two variables that will hold an integer
x=7; # Set variable X to value 7
x-- ; # Decrement x by one : so x equals 7 - 1 = 6
y= x * 2; # Multiply x by two and set the result to the y variable: 6 times 2 equals 12
x=3; # set x to value 3 (I do not know why this is here).