Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

init.c

Go to the documentation of this file.
00001 
00002 typedef struct { int codes[3]; char name[6]; } Word;
00003 
00004 Word words[] = {
00005     1, 2, 3, "if",
00006     { { 4, 5 }, { 'f', 'o', 'r' } },
00007     6, 7, 8, {"else"},
00008     { { 9, 10, 11,}, 'w', 'h', 'i', 'l', 'e', },
00009     { 0 },
00010 }, *wordlist = words;
00011 
00012 int x[][5] = { 1, 2, 3, 4, 0, { 5, 6 }, { 7 } };
00013 int *y[] = { x[0], x[1], x[2], 0 };
00014 
00015 
00016 main()
00017 {
00018     int i, j;
00019 
00020     for (i = 0; y[i]; i++) {
00021         for (j = 0; y[i][j]; j++)
00022             printf(" %d", y[i][j]);
00023         printf("\n");
00024     }
00025     f();
00026     g(wordlist);
00027     return 0;
00028 }
00029 
00030 f() {
00031     static char *keywords[] = {"if", "for", "else", "while", 0, };
00032     char **p;
00033 
00034     for (p = keywords; *p; p++)
00035         printf("%s\n", *p);
00036 }
00037 
00038 g(p)
00039 Word *p;
00040 {
00041     int i;
00042 
00043     for ( ; p->codes[0]; p++) {
00044         for (i = 0; i < sizeof p->codes/sizeof(p->codes[0]); i++)
00045             printf("%d ", p->codes[i]);
00046         printf("%s\n", p->name);
00047     }
00048     h();
00049 }
00050 
00051 h()
00052 {
00053     int i;
00054 
00055     for (i = 0; i < sizeof(words)/sizeof(Word); i++)
00056         printf("%d %d %d %s\n", words[i].codes[0],
00057             words[i].codes[1], words[i].codes[2],
00058             &words[i].name[0]);
00059 }

Generated on Thu Aug 25 12:38:14 2005 for Quake III Arena by  doxygen 1.3.9.1