+ 1

Unassigned Variable in C++ on SoloLearn

Interestingly with the code I've linked I get 8 and 37 as the output every time. I guess that's what's in RAM on the sololearn server or can someone explain why it's always those numbers. https://code.sololearn.com/cZjv5U22qGtL/

26th May 2018, 9:01 PM
Jeromy Reimer
Jeromy Reimer - avatar
3 odpowiedzi
+ 2
my guess would be that sololearn executes this code in some kind of sandbox on its servers and that you get the same predictable values in memory because of that
26th May 2018, 11:18 PM
Max
Max - avatar
+ 1
Max Yeah, I think the memory get's changed by the compilation of the code before the program gets run. Whatever the case it doesn't matter cause one should never use a variable without assigning anything to it first. It won't have a reliable or always predictable value.
26th May 2018, 11:25 PM
Jeromy Reimer
Jeromy Reimer - avatar
0
if they are starting a sandbox for every program and all of the stuff is deterministic, you should always get the same values since the initial state if the sandbox is always the same
26th May 2018, 11:27 PM
Max
Max - avatar