Integer updating (C++) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Integer updating (C++)

lets say I have made 2 integers, (x and y), which are both the number 4. If I make another integer (sum) that is x + y and I print it, it will print 8. But if I then change x to 5 and print the int sum again, will it say 9 or will it still think x = 4 and say 8?

24th Aug 2017, 3:13 PM
ReimarPB
ReimarPB - avatar
2 Answers
+ 2
Sum will become 9 as long as the variables x and y are assigned their values above sum, and the program is run again after making the changes.
24th Aug 2017, 3:29 PM
Zeke Williams
Zeke Williams - avatar
+ 2
@Zeke Williams thanks!
24th Aug 2017, 3:30 PM
ReimarPB
ReimarPB - avatar