diff --git a/ch4/helper.h b/ch4/helper.h new file mode 100644 index 0000000..ca17d75 --- /dev/null +++ b/ch4/helper.h @@ -0,0 +1,3 @@ + + +extern int sum; diff --git a/ch4/main.c b/ch4/main.c new file mode 100644 index 0000000..3452ddc --- /dev/null +++ b/ch4/main.c @@ -0,0 +1,19 @@ +#include +#include "helper.h" + +void increment(); + +int main() { + printf("hello world\n"); + + increment(); + increment(); + + printf("sum within main: %d\n", sum); + + sum++; + + printf("sum within main: %d\n", sum); + + return 0; +} diff --git a/ch4/other.c b/ch4/other.c new file mode 100644 index 0000000..a94971f --- /dev/null +++ b/ch4/other.c @@ -0,0 +1,8 @@ +#include +#include "helper.h" + +int sum = 0; + +void increment() { + sum++; +}