From dc6912769121c335c6b09a6c002a4a8e0528703a Mon Sep 17 00:00:00 2001 From: Xavier ASUS Date: Mon, 28 Oct 2019 15:53:52 +0100 Subject: First commit --- src/bar.c | 15 +++++++++++++++ src/main.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/bar.c create mode 100644 src/main.c (limited to 'src') diff --git a/src/bar.c b/src/bar.c new file mode 100644 index 0000000..7282ea2 --- /dev/null +++ b/src/bar.c @@ -0,0 +1,15 @@ +#include "bar.h" + +void bar(const int x) +{ + int i; + + /* Some stupid calculations here and there. */ + for (i = 0; i < 90; i++) + { + if (i - x) + { + for (;;); + } + } +} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..03e5944 --- /dev/null +++ b/src/main.c @@ -0,0 +1,30 @@ +#include "bar.h" + +struct example +{ + int a; + char b; + int *c; +}; + +static void foo(struct example *const st) +{ + if (st) + { + if (st->c) + { + (*st->c)++; + } + } +} + +_Noreturn void main(void) +{ + static struct example st; + + foo(&st); + + bar(st.a); + + for (;;); +} -- cgit v1.2.3