Created
July 18, 2013 02:55
-
-
Save kinoshita-lab/6026362 to your computer and use it in GitHub Desktop.
ternary conditional expression as an argument
This file contains hidden or 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 <cstdlib> | |
#include <cstdio> | |
#include <stdint.h> | |
void func(bool a) | |
{ | |
if (a) { | |
puts("true"); | |
} else { | |
puts("false"); | |
} | |
} | |
int main(void) | |
{ | |
for (int i = 0; i < 10; ++i) { | |
const int v = rand(); | |
func(v % 2 ? true : false); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment