From 974ccc9f27f6a04d679285e55b65ad27dddfe08d Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 12 Mar 2018 22:29:27 +0100 Subject: [PATCH] ... --- 01_ENV/a.out | Bin 6152 -> 6152 bytes 01_ENV/build-c.sh | 2 +- 01_ENV/func1.c | 18 ++++++++++++++---- 01_ENV/func1.o | Bin 1272 -> 1744 bytes 01_ENV/main.c | 20 ++++++++++++++++---- 01_ENV/main.o | Bin 2312 -> 2504 bytes 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/01_ENV/a.out b/01_ENV/a.out index 72d69b6abe4637ce75a3ebbfe66a212f99e05c43..63075a8948798f24bea4d469795765f04ee2d982 100755 GIT binary patch delta 1018 zcmaJ=ZAep57`}I(=iVP~)GYeKL0MUpmePk>IO)(eBCIrpvZS^s7zMdOe{LGLz{6Gg zI0Qma67@&?AHWk$e#o^9$1>cZhU5AXXv&w0;#PiI+Y z+5HK*Ll!b$hx}mb&8mKsW&Nlov*|~nKC#YJ091*L_S!i_;vvyu7TXmq=_G1OQ&WPY z>j0$dIHfU>MA#FbSQNh^|hvTKdhpuKiA~N)Ix)lpXnH z@od?crpA}c;%p95%$O0(bR5@4M1tdqsm%3u{~`4`op*v5mx|zMR&hjAqo7y`tX)^5 z>;*^?JgMW!tgxms!EslDu#RIHi&%nJ>NuKV(Zq1ZuxHsY24}wxhG7?^5j@Nuf@F>i zu^AwGb#a-qRnUV;f(KbS+$h0G9Un@`K*0|}E?^5tao6o(c(p~J8g(bQ-L+NIF)729}zrQWu z^ZR|*vN_-+ZZKCh1In;m3x@F=umUi^Idn44IUpZl1E56|gh4W1=yOx+V2q_c5 zig-+#05%Ei75#zMiZ`hw9Tj^+C#9!m>MS@YqR_E|3pUY0`&^|`ZVWC&zqyS zXLPQ+FF~tfznIY8?v!Xp+?&IHUAM|Z7{QBnzw5eM^@JZzKD_4a=$ik<_p|GL5&Sx~ z*)(6x(9=gB>8uV%z>q?*x1Aj{99^!G_p(E3B=>>g%}4K=6W5Y_7I7?fZ}{ z;1 +#include + #define func1 int func3(int x) { + //return pow(x, 3) - 3 * pow(x, 2) - x + 3; return x + 10; } @@ -8,11 +12,17 @@ int func2(int x) { return x - 10; } -int recurse1(int count) { - return func1(count - 1); +int recurse1(int count) { + if(count >= 0) { + printf("Recurse 1: %d\n", func3(count - 1)); + return recurse1(count - 1); + }else return 0; } -int recurse2(int x) { - +int recurse2(int count) { + if(count >= 0) { + printf("Recurse 2: %d\n", func3(count - 1)); + return recurse1(count - 1); + }else return 0; } diff --git a/01_ENV/func1.o b/01_ENV/func1.o index c3f3edf6adbf40e7c9b5b8c3e6ff55373660f9ab..3a13b6836157540d1dfb89ee4e9e94c468fc157c 100644 GIT binary patch literal 1744 zcmbW1&ubGw6vt=VVr!@-ih`iny%ZGey1O+o_@hKhG@ulz7L-!zW;?OPW)pWer3$G+ zL|p2@zd(BR*1HD}E#|5>{{bO_D1u-PDe=9{8#`=L1s^2ueLwHV&dg5oBzxm(pQ12f z3Y%cNN>Ijb4(!I6FwC$RRL1-=k+fK}F#Ye*R?LB|u-}7hxGJl%e71!gcaX}qjh%q6}j%4<-<=j_Sxa%#I95tos znm*>OIOAq2nbgOOHNILl)=b?<>*IP7zR#KGwUnuz%Da|hFLLj!%a^(3@%fZ~8ux{E zq~n?oZzFru(bh)S^5B@OJtE9tqLwt)k;m&?QjKU`&pyU@J#yJ^c;T|Er zOMD~37f9o8pr2xN4=KhS;F-4ITA*zc7xi({AIV4SRf%Ix*d+>(;YTHXhrHk!(td<* zkY*ZO8cXx}s?RjLR4j4_0;lA2?b_7LnCDye16FpI9KS%Nd~v?uT1CzZ6~{I-n`xf! z`c@wNqau3b3^7%CJW*zCkE08Ahy delta 365 zcmcb>`-5|WhUgC_1~_m4vm6*WCfd4lcGmvsuKm;eo^hhDB-@W}*FUj`Cr2}eOy0m4 zGx-Xm$Ycd34o05InoR19`jZ2h^d-Z9nuQpc7!<&UFfa&0Y4^z+nZylZpt25Vvc6F9 z1gJO<^W<4kbqDO_LC>FiEDH)LbxlSq986a5TmOG0BwFd AhX4Qo diff --git a/01_ENV/main.c b/01_ENV/main.c index 4fc4ca5..5ed484e 100644 --- a/01_ENV/main.c +++ b/01_ENV/main.c @@ -27,16 +27,28 @@ int main(int argc, char **argv) { printf("For: %d\n", tmp); - int temp = 0; + tmp = 0; int j = 0; while(j <= 5) { - temp += func3(j); + tmp += func3(j); ++j; } - printf("While: %d\n", temp); + + printf("While: %d\n", tmp); - printf("Recurse 1: %d\n", recurse1(2)); + tmp = 0; + int zeroes = 0; + for(int i = 0; i <= 5; ++i) { + int func = func3(i); + tmp += func; + if(tmp == 0) zeroes++; + } + printf("Nullstellen: %d\n", zeroes); + + + recurse1(20); + recurse2(20); local = sum(global, local); return local; diff --git a/01_ENV/main.o b/01_ENV/main.o index 36ff3a522f8053579a0d5b31f5ff10571c7f71c3..03be1ba0efcad78d13c69dc1962db7b472e92174 100644 GIT binary patch delta 550 zcmYjNJ4?e*7|oa1BvnLwKnn`CgHoNU4h2!G!i7%aA`ar9QgtXks>LZN1Ro)TmJdf4 zC+ni1qJr3hq7DuY3K2TQErtF72Ql7z`eq7vgMvASMQ0{SFmb=$=?!wxDYk&35yw#VrPTHp#Qsplgm$v+ie8QsiC55(}Ed;>;>txvu-S zvY9FV?A$`S0%y9lsul%Q97`^Rw#bvXB?tWrGWAgGVor|3E0*M# zKT+Xn@7Siq#3m6ZmDcbE)mU|>H~T$9YypZH%qcP0#5W}lFBn$iVBv%s7yD)0SNr@C L$+Ly9q&9y6Gm59g delta 434 zcmX>h+#xhUgUN$!qLwYA!^8|L#TzdefWTuvhy;PoV;dO2Li?FOJl87|4{I=9nE1w~ z{sBn(xa%Dd)#-Ysx%Lh#f4>Zn(_MQ9tb^J0L8t43Zr3}_2N*kD@4USA|Nno4!QG_~ zP)$C8%jRwyRgfLsrEfZ2kGz=s@BjZ!*Eii9u5Ub=k2u60o-EB2%^8%MTv}9|s$e*| zktuZY4JHRh|H+cf`I9ABBqlFl2Js#;%QKctUdSxI*?^^i(a?$!WF`Xx$XA>|{0Hbb z5O9EsgD7So4g+Ek@SXgSRh%(ovL@Ts$Gp0{|2qZHmD{|U1 Wb+ArO;