mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Add enum to C.
This commit is contained in:
parent
411d9a9813
commit
2e8e2b5f35
@ -54,6 +54,10 @@ Multi-line comments look like this. They work in C89 as well.
|
||||
// Constants: use #define keyword, no semicolon at end.
|
||||
#define DAYS_IN_YEAR = 365
|
||||
|
||||
//enumeration constants are also ways to declare constants.
|
||||
enum days {SUN = 1, MON, TUE, WED, THU, FRI, SAT};
|
||||
// MON gets 2 automatically, TUE gets 3, etc.
|
||||
|
||||
// Import headers with #include
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
Loading…
Reference in New Issue
Block a user