summaryrefslogtreecommitdiff
path: root/tests/array_of_structs.c
blob: 0ab53b98f99f95222b80512a1c11cb448d8c1717 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
struct option {
  char *name;
  int has_arg;
  int *flag;
  int val;
};

static struct option const options[] = {
  {"whatisup", 1, 0, 0},
  {"helloworld", 2, 0, 0},
  {"version", 3, 0, 0},
  {"help", 4, 0, 0},
  {"etc", 5, 0, 0},
  {0, 0, 0, 0},
};

void puts(char *x);

int main() {
  for (struct option *opt = options; opt->name; opt++) {
    puts(opt->name);
  }
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback