# cpp problem Why `bool B` becomes 0? ```cpp= #include<iostream> using namespace std; int main () { bool B = false; cout << B << endl; if (1) { cout << B << endl; if (1) { cout << B << endl; if (1) { cout << B << endl; bool B = true; cout << B << endl; } cout << B << endl; } cout << B << endl; } cout << B << endl; cout << "#################" << endl; bool L = false; cout << L << endl; if (1) { cout << L << endl; if (1) { cout << L << endl; if (1) { cout << L << endl; L = true; cout << L << endl; } cout << L << endl; } cout << L << endl; } cout << L << endl; return 1; } ``` ## result ```typescript= 0 0 0 0 1 0 0 0 ################# 0 0 0 0 1 1 1 1 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up