Last active
August 29, 2015 14:02
-
-
Save csukuangfj/47e722f89c7635bbec97 to your computer and use it in GitHub Desktop.
Programming notes
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> | |
enum header_type | |
{ | |
TYPE1 = 15, | |
TYPE2 = 16, | |
TYPE3 = 17, | |
TYPE_END = 22, | |
}; | |
const static unsigned char abc[] = | |
{ | |
[0] = 1, | |
[1] = 3, | |
[2] = 4, | |
[3] = 11, | |
[6] = 2, | |
[5] = 3, | |
[10 ... 12] = 13, | |
[TYPE1] = 155, | |
[TYPE2] = 166, | |
[TYPE3] = 177, | |
}; | |
struct point | |
{ | |
int x; | |
int y; | |
}; | |
struct point pa = { .x = 1, .y = 2}; | |
struct point pb = { .y = 33, .x = 100}; | |
struct point parray[] = | |
{ | |
[0].x = 0, [0].y = 0, | |
[1].x = 1, | |
[5].x = 5, [5].y = 5, | |
}; | |
void main() | |
{ | |
int i = 0; | |
for(i = 0; i < sizeof(abc) / sizeof(abc[0]); i++) | |
{ | |
printf("abc[%d] = %d\n",i, abc[i]); | |
} | |
printf("pa: (%d, %d)\n", pa.x, pa.y); | |
printf("pb: (%d, %d)\n", pb.x, pb.y); | |
for(i = 0; i < sizeof(parray) / sizeof(parray[0]); i++) | |
{ | |
printf("parray[%d]: (%d, %d)\n", i, parray[i].x, parray[i].y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment