source:
CIVL/mods/dev.civl.abc/examples/enum1.c
| Last change on this file was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 321 bytes | |
| Rev | Line | |
|---|---|---|
| [aad342c] | 1 | #include<stdio.h> |
| 2 | ||
| 3 | enum a {A}; | |
| 4 | enum a; // refers to same enum as above | |
| 5 | ||
| 6 | int main() { | |
| 7 | enum a x=A; // refers to enum above in root scope | |
| 8 | printf("%d\n", x); // prints 0 | |
| 9 | enum a {B,A}; // a new enum in this scope | |
| 10 | enum a y=A; // refers to new enum and new A in this scope | |
| 11 | printf("%d\n", y); // prints 1 | |
| 12 | return 0; | |
| 13 | } |
Note:
See TracBrowser
for help on using the repository browser.
