If I understand correctly, your confusion is this.
- OK, I hear an uninitialized variable has no value, and that kind of makes sense
- but, like, it's RAM, right?
- is the RAM capable of not having a value? how does this work?
I think the only really satisfying answer is to know a little bit about compiler optimizations. All undefined behavior is there to allow compilers to produce more efficient code by assuming that UB does not happen.
Example: Reading off the end of an array is undefined behavior. This licenses C/C++ compilers to assume array reads are always OK and skip bounds checks.
Example: Writing through an invalid pointer is undefined behavior. So the compiler isn't required to track when pointers become dangling, for example.
Now an uninitialized memory example. Optimizing compilers love to delete code. Truly one of the most powerful optimizations they do is inlining a function and deleting the parts that aren't used at that call site. A compiler is entitled to assume that programs never read uninitialized memory, so if it sees code that does read uninitialized memory, well, the only possible conclusion is that that code must never actually run. So the compiler can delete it—and everything after it in the same block—and everything before it, back to the previous branch. Some compilers really do this. It's wild.
tl;dr - The uninitialized variable is not a byte of RAM. The compiler might put it in RAM, or into a register, or optimize it away entirely (in which case it really truly doesn't have a value, even behind the scenes). In any case, violating the compiler's assumptions is a very bad idea.