summaryrefslogtreecommitdiff
path: root/tests/array_of_structs.c
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthew@masot.net>2023-07-25 14:58:33 -0700
committerMatthew Sotoudeh <matthew@masot.net>2023-07-25 14:58:33 -0700
commit1d943da0cf9154e7ce78ce867cdbb91531c5d78e (patch)
tree40c5c6c3ba7fafa6567aa5b5aa216caecf3935fc /tests/array_of_structs.c
initial dietc commit
Diffstat (limited to 'tests/array_of_structs.c')
-rw-r--r--tests/array_of_structs.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/array_of_structs.c b/tests/array_of_structs.c
new file mode 100644
index 0000000..0ab53b9
--- /dev/null
+++ b/tests/array_of_structs.c
@@ -0,0 +1,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