diff --git a/01_ENV/a.out b/01_ENV/a.out index 63075a8..08b5a27 100755 Binary files a/01_ENV/a.out and b/01_ENV/a.out differ diff --git a/01_ENV/build-c.sh b/01_ENV/build-c.sh index 57fe08e..2cf356d 100755 --- a/01_ENV/build-c.sh +++ b/01_ENV/build-c.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash bash clean.sh clang-6.0 -c func1.c main.c -clang-6.0 -s func1.o main.o -lm \ No newline at end of file +clang-6.0 -s func1.o main.o -lm diff --git a/01_ENV/func1.c b/01_ENV/func1.c index fbdbe93..b85bebe 100644 --- a/01_ENV/func1.c +++ b/01_ENV/func1.c @@ -4,24 +4,24 @@ #define func1 int func3(int x) { - return pow(x, 3) - 3 * pow(x, 2) - x + 3; + return (x-2)*(x-4)*(x-11)*(x-18); } int func2(int x) { return pow(x, 4) - 5 * pow(x, 3) + pow(x, 2) + 5; } -int recurse1(int count) { +void recurse1(int count) { if(count >= 0) { - printf("Recurse 1: %d", func3(count - 1)); - return recurse1(count - 1); - }else return 0; + printf(" %d", func2(count)); + recurse1(count - 1); + } } -int recurse2(int count) { +void recurse2(int count) { if(count >= 0) { - printf("Recurse 2: %d", func3(count - 1)); - return recurse1(count - 1); - }else return 0; -} \ No newline at end of file + recurse1(count - 1); + printf(" %d", func2(count)); + } +} diff --git a/01_ENV/func1.h b/01_ENV/func1.h index 3e305c9..c3bb74b 100644 --- a/01_ENV/func1.h +++ b/01_ENV/func1.h @@ -1,5 +1,5 @@ -int func3(int x); int func2(int x); +int func3(int x); int recurse1(int x); int recurse2(int x); diff --git a/01_ENV/func1.o b/01_ENV/func1.o index 3a13b68..cbd08e0 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 361f0dc..dbce4c1 100644 --- a/01_ENV/main.c +++ b/01_ENV/main.c @@ -4,7 +4,6 @@ int global = 8150; - int sum(int,int); int sum(int a, int b) { @@ -16,8 +15,8 @@ int sum(int a, int b) { int main(int argc, char **argv) { int local=4711; printf("Hello, world!\nglobal=%d local=%d\n", global, local); - printf("Funktion 1: %d\n" ,func3(2)); printf("Funktion 2: %d\n" , func2(2)); + printf("Funktion 3: %d\n", func3(2)); int tmp = 0; @@ -35,19 +34,19 @@ int main(int argc, char **argv) { } printf("While: %d\n", tmp); - + tmp = 0; int zeroes = 0; - for(int i = 0; i <= 5; ++i) { - int func = func3(i); - tmp += func; - if(tmp == 0) zeroes++; + for(int i = 0; i <= 20; ++i) { + if(func3(i) == 0) zeroes++; } printf("Nullstellen: %d\n", zeroes); recurse1(20); + printf("\n"); recurse2(20); + printf("\n"); local = sum(global, local); return local; diff --git a/01_ENV/main.o b/01_ENV/main.o index 03be1ba..05406b8 100644 Binary files a/01_ENV/main.o and b/01_ENV/main.o differ