MP01_ Modifikation 1,2,3

This commit is contained in:
Johannes Theiner 2018-03-12 21:11:29 +01:00
parent 83923c1e71
commit cf4270554f
7 changed files with 44 additions and 7 deletions

Binary file not shown.

View File

@ -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

View File

@ -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) {
}

View File

@ -1 +1,5 @@
int func3(int x);
int func2(int x);
int recurse1(int x);
int recurse2(int x);

Binary file not shown.

View File

@ -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;
}

Binary file not shown.