Last active
August 29, 2015 14:16
-
-
Save Code-Hex/ce5a21fd01696449a539 to your computer and use it in GitHub Desktop.
typedef と enum(列挙体)を使った例
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 <stdio.h> | |
/* 列挙体定義 */ | |
typedef enum boolean { // enum boolean で enum boolean という型を作成 | |
false, | |
true | |
} bool; /* typedef で bool型として定義した */ | |
int main(){ | |
bool flag = true; | |
puts(flag ? "true" : "false"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment