Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Question about variables (vague question desc)

$
0
0
I know the topic is really vague, but I don't know how to formulate it!
It might not be isolated to C/C++ either but since I dev in C++ I put it here when I didn't know where else to put it!

Anyway here is my question.

Is it possible for a variable to change value if a program is running for whatever reason?
My friend say "no" I say "It is might not happen but it is possible".

This is the snippet of code he commented on
assert(s2 == s5);
	assert(s2 != s3);
	assert(s2 != s5); 


My argument is that something in the computer might unintentionally or by corruption change the value in the memory(?)location my "s2" is "assigned" to, so if the first assert passes and the program continues to the next and that passes too it MIGHT happen that the next assert also passes because by some "fluke" something in the computer changed the value so it will pass. My friend say it is impossible, for me is is possible even if it is a very small possibility for it to actually happen.

So even if it is really unlikely can it happen?
I hope I was clear enough in what I wanted to know! :)/>/>

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>