diff --git a/01_ENV/test.out b/01_ENV/a.out similarity index 69% rename from 01_ENV/test.out rename to 01_ENV/a.out index da4d0d1..72d69b6 100755 Binary files a/01_ENV/test.out and b/01_ENV/a.out differ diff --git a/01_ENV/build-c.sh b/01_ENV/build-c.sh index 7665a29..d48a80e 100755 --- a/01_ENV/build-c.sh +++ b/01_ENV/build-c.sh @@ -1,2 +1,3 @@ +bash clean.sh clang-6.0 -c func1.c main.c -clang-6.0 -o test.out -s func1.o main.o +clang-6.0 -s func1.o main.o diff --git a/01_ENV/func1.c b/01_ENV/func1.c index 89d4cf8..29d68a5 100644 --- a/01_ENV/func1.c +++ b/01_ENV/func1.c @@ -1,5 +1,18 @@ #define func1 -int func2(int x) { +int func3(int x) { return x + 10; } + +int func2(int x) { + return x - 10; +} + +int recurse1(int count) { + return func1(count - 1); +} + + +int recurse2(int x) { + +} diff --git a/01_ENV/func1.h b/01_ENV/func1.h index ddc106b..3e305c9 100644 --- a/01_ENV/func1.h +++ b/01_ENV/func1.h @@ -1 +1,5 @@ +int func3(int x); int func2(int x); + +int recurse1(int x); +int recurse2(int x); diff --git a/01_ENV/func1.o b/01_ENV/func1.o index 006a2b9..c3f3edf 100644 Binary files a/01_ENV/func1.o and b/01_ENV/func1.o differ diff --git a/01_ENV/main.c b/01_ENV/main.c index 64a68a7..4fc4ca5 100644 --- a/01_ENV/main.c +++ b/01_ENV/main.c @@ -7,18 +7,37 @@ int global = 8150; int sum(int,int); -int sum(int a, int b){ +int sum(int a, int b) { int result = 451; result = a + b; return result; } - -int main(int argc, char **argv) -{ +int main(int argc, char **argv) { int local=4711; printf("Hello, world!\nglobal=%d local=%d\n", global, local); - printf("Hallo Welt %d\n" ,func2(2)); + printf("Funktion 1: %d\n" ,func3(2)); + printf("Funktion 2: %d\n" , func2(2)); + + + int tmp = 0; + for(int i = 0; i <= 5; ++i) { + tmp += func3(i); + } + + printf("For: %d\n", tmp); + + int temp = 0; + int j = 0; + while(j <= 5) { + temp += func3(j); + ++j; + } + printf("While: %d\n", temp); + + + printf("Recurse 1: %d\n", recurse1(2)); + local = sum(global, local); return local; } diff --git a/01_ENV/main.o b/01_ENV/main.o index f5185f2..36ff3a5 100644 Binary files a/01_ENV/main.o and b/01_ENV/main.o differ