This commit is contained in:
Johannes Theiner 2018-03-12 23:17:36 +01:00
parent 581d3f5e09
commit 2096abcc38
3 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
bash clean.sh bash clean.sh
clang-6.0 -c func1.c main.c -lm clang-6.0 -c func1.c main.c
clang-6.0 -s func1.o main.o -lm clang-6.0 -s func1.o main.o -lm

View File

@ -8,12 +8,12 @@ int func3(int x) {
} }
int func2(int x) { int func2(int x) {
return x - 10; return pow(x, 4) - 5 * pow(x, 3) + pow(x, 2) + 5;
} }
int recurse1(int count) { int recurse1(int count) {
if(count >= 0) { if(count >= 0) {
printf("Recurse 1: %d\n", func3(count - 1)); printf("Recurse 1: %d", func3(count - 1));
return recurse1(count - 1); return recurse1(count - 1);
}else return 0; }else return 0;
} }
@ -21,7 +21,7 @@ int recurse1(int count) {
int recurse2(int count) { int recurse2(int count) {
if(count >= 0) { if(count >= 0) {
printf("Recurse 2: %d\n", func3(count - 1)); printf("Recurse 2: %d", func3(count - 1));
return recurse1(count - 1); return recurse1(count - 1);
}else return 0; }else return 0;
} }

View File

@ -36,7 +36,6 @@ int main(int argc, char **argv) {
printf("While: %d\n", tmp); printf("While: %d\n", tmp);
tmp = 0; tmp = 0;
int zeroes = 0; int zeroes = 0;
for(int i = 0; i <= 5; ++i) { for(int i = 0; i <= 5; ++i) {
@ -47,8 +46,8 @@ int main(int argc, char **argv) {
printf("Nullstellen: %d\n", zeroes); printf("Nullstellen: %d\n", zeroes);
//recurse1(20); recurse1(20);
//recurse2(20); recurse2(20);
local = sum(global, local); local = sum(global, local);
return local; return local;