C_CPP/01_ENV/main.c

56 lines
862 B
C

#include <stdio.h>
#include "func1.h"
int global = 8150;
int sum(int,int);
int sum(int a, int b) {
int result = 451;
result = a + b;
return result;
}
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));
int tmp = 0;
for(int i = 0; i <= 5; ++i) {
tmp += func3(i);
}
printf("For: %d\n", tmp);
tmp = 0;
int j = 0;
while(j <= 5) {
tmp += func3(j);
++j;
}
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++;
}
printf("Nullstellen: %d\n", zeroes);
//recurse1(20);
//recurse2(20);
local = sum(global, local);
return local;
}