Skip to content

Instantly share code, notes, and snippets.

@Code-Hex
Last active August 29, 2015 14:16
Show Gist options
  • Save Code-Hex/ce5a21fd01696449a539 to your computer and use it in GitHub Desktop.
Save Code-Hex/ce5a21fd01696449a539 to your computer and use it in GitHub Desktop.
typedef と enum(列挙体)を使った例
#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