MP_01 Testat
This commit is contained in:
parent
7bfc780c81
commit
8f7457e64d
Binary file not shown.
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
bash clean.sh
|
||||
clang-6.0 -c func1.c main.c
|
||||
clang-6.0 -s func1.o main.o -lm
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# generate main.s, main.o, b.out
|
||||
pcc -O0 -S main.c
|
||||
as -o main.o main.s
|
||||
#ld -o b.out main.o /lib/crt0.o /lib/crti.o -lc
|
||||
pcc -o b.out main.o
|
||||
|
||||
# generate a.out
|
||||
pcc -O0 -g main.c
|
||||
|
||||
# generate assembly intermixed with source code
|
||||
objdump -S a.out > objdump-S_a.out.txt
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
rm *.o *.out
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int func1(int x) {
|
||||
return (x-2)*(x-6)*(x-10)*(x-15);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
int func1(int x);
|
Binary file not shown.
|
@ -0,0 +1,29 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "func1.h"
|
||||
|
||||
int recursive(int start, int stop);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int zero = 0;
|
||||
for(int i = 0; i <= 20; ++i) {
|
||||
int tmp = func1(i);
|
||||
printf("Stelle: %d Wert: %d\n", i, tmp);
|
||||
if(tmp == 0) ++zero;
|
||||
}
|
||||
|
||||
printf("Nullstellen: %d\n", zero);
|
||||
|
||||
recursive(0, 20);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int recursive(int start, int stop) {
|
||||
if(start <= stop) {
|
||||
recursive(start + 1, stop);
|
||||
printf("Stelle: %d, Wert: %d\n", start, func1(start));
|
||||
}
|
||||
return 0;
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue