int myInt;
cout << myInt; // Garbage like 429948, etc
If I output and/or work with uninitialized variables in C++, what are their assumed values?
- Actual values in the memory from the "last user"?
e.g.: Program A is closed, it had an int with the value 1234
at 0x1234
-> I run my program, myInt
gets the address 0x1234
, I output it like above -> 1234
- Is it just random garbage?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…