Created
August 1, 2021 04:02
-
-
Save littleblacklb/0d42b2930d1a055fc0fb50bc3aa0f20d to your computer and use it in GitHub Desktop.
&& and & in if condition test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
bool b = false; | |
bool modifyB2True() { | |
b = true; | |
return true; | |
} | |
/** | |
* & and && test | |
* | |
* author: littleblackLB | |
*/ | |
int main() { | |
bool a = false; | |
if (a & modifyB2True()) { // b -> rtn: true | |
} | |
// if (a && modifyB2True()) { // b -> rtn: false | |
// } | |
cout << b << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment