Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csukuangfj/47e722f89c7635bbec97 to your computer and use it in GitHub Desktop.
Save csukuangfj/47e722f89c7635bbec97 to your computer and use it in GitHub Desktop.
Programming notes
#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