...

/

Discussion: Going Global

Discussion: Going Global

Execute the code to understand the output and gain insights into global variables.

Run the code

Now, it’s time to execute the code and observe the output.

Press + to interact
#include <iostream>
int id;
int main()
{
std::cout << id;
}

Understanding the output

This puzzle looks similar to the Hack the Planet! puzzle; they both use the value of an uninitialized variable id. However, this is not an undefined behavior, and the program prints 0 ...