einbinden weiterer Dateien
This commit is contained in:
13
src/funktionen.h
Normal file
13
src/funktionen.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#ifndef FUNKTIONEN_H
|
||||||
|
|
||||||
|
#define FUNKTIONEN_H
|
||||||
|
|
||||||
|
int mult(int a, int b) {
|
||||||
|
return a * b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int add(int a, int b) {
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
16
src/main.c
16
src/main.c
@@ -1,18 +1,8 @@
|
|||||||
#include<stdio.h>
|
#include<stdio.h>
|
||||||
#define DEBUG 5
|
#include "funktionen.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int a=2, b=3, ergebnis;
|
printf("Produkt: %d\n", mult(4, 5));
|
||||||
ergebnis = (2*a) + (2*b);
|
printf("Summe: %d\n", add(4, 5));
|
||||||
|
|
||||||
#if DEBUG >= 1
|
|
||||||
printf("* Debug: ergebnis = (2*%d) + (2*%d);\n", a, b);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEBUG >= 2
|
|
||||||
printf("* Debug: a=%d, b=%d, ergebnis=%d\n", a, b, ergebnis);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("Das Ergebnis ist %d\n", ergebnis);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user