+ 1

Can someone clearly explain variables and changing its value after assigning a value in the codes_int x =3, int y=4 , y=x!?!?!?

variables and values

18th Jan 2017, 8:59 PM
Amr Monsef
Amr Monsef - avatar
4 ответов
+ 2
Variables are like buckets. When you assign a value to the variable you put something into the bucket. In your case I will explain it with apples as int you put 3 apples into your bucket. x that is x=3 then you put 4 apples into bucket y that is y=3 then you put all apples out of bucket y and you copy the number of apples out of x and put them in bucket y. that is y=x
18th Jan 2017, 9:03 PM
Andreas K
Andreas K - avatar
+ 2
int x = 3 (you defined a new variable of type integer with an initial value of 3) int y = 4 (you created another variable of type integer with an initial value of 4) y = x (you assigned the value of x into y, which changes the value of y from 4 to 3)
18th Jan 2017, 9:39 PM
Alex
+ 1
x == 3 and y==3
18th Jan 2017, 9:09 PM
Andreas K
Andreas K - avatar
0
akc that means now ×=? , y=? what are the actual values now for x and y?
18th Jan 2017, 9:07 PM
Amr Monsef
Amr Monsef - avatar