+ 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/
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
+ 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.
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