removed static linked libs from binaries to minimize them
This commit is contained in:
parent
fa9c07b950
commit
3f4f7f6ebb
23 changed files with 106 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
|||
SRCS = $(wildcard src/*.c)
|
||||
PROGS = $(patsubst src/%.c,%,$(SRCS))
|
||||
|
||||
CFLAGS += -g -Wall -O0 -ansi -static
|
||||
CFLAGS += -g -Wall -O0 -ansi
|
||||
VPATH = src/
|
||||
|
||||
all: $(PROGS)
|
||||
|
|
Binary file not shown.
BIN
bin/1_n_b_ascii
BIN
bin/1_n_b_ascii
Binary file not shown.
BIN
bin/1_p_a_kanten
BIN
bin/1_p_a_kanten
Binary file not shown.
BIN
bin/1_v_a_square
BIN
bin/1_v_a_square
Binary file not shown.
BIN
bin/2_p_b_raten
BIN
bin/2_p_b_raten
Binary file not shown.
BIN
bin/2_p_c_tree
BIN
bin/2_p_c_tree
Binary file not shown.
Binary file not shown.
BIN
bin/2_v_b_logic
BIN
bin/2_v_b_logic
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/3_n_c_userdb
BIN
bin/3_n_c_userdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/4_n_a_swap2
Executable file
BIN
bin/4_n_a_swap2
Executable file
Binary file not shown.
BIN
bin/4_n_b_strlen
Executable file
BIN
bin/4_n_b_strlen
Executable file
Binary file not shown.
BIN
bin/4_p_a_swap
Executable file
BIN
bin/4_p_a_swap
Executable file
Binary file not shown.
BIN
bin/4_p_c_strings
Executable file
BIN
bin/4_p_c_strings
Executable file
Binary file not shown.
33
src/4_n_a_swap2.c
Normal file
33
src/4_n_a_swap2.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int i = 0;
|
||||
|
||||
void swap (int * x, int * y) {
|
||||
int temp;
|
||||
temp = *x;
|
||||
*x = *y;
|
||||
*y = temp;
|
||||
}
|
||||
|
||||
int f() {
|
||||
i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
int main () {
|
||||
int feld[4] = {4, 3, 2, 1};
|
||||
int zahl1 = 5, zahl2 = 3;
|
||||
|
||||
/* 2. Aufgabenteil */
|
||||
printf("vor swap: zahl1=%d, zahl2=%d\n", zahl1, zahl2);
|
||||
swap(&zahl1, &zahl2);
|
||||
printf("nach swap: zahl1=%d, zahl2=%d\n", zahl1, zahl2);
|
||||
|
||||
/* 3. Aufgabenteil */
|
||||
printf ("feld-Inhalt vor swap: {%d, %d, %d, %d}\n", feld[0], feld[1], feld[2], feld[3]);
|
||||
swap (&i, &feld[f()]);
|
||||
printf ("feld-Inhalt nach swap: {%d, %d, %d, %d}\n", feld[0], feld[1], feld[2], feld[3]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
16
src/4_n_b_strlen.c
Normal file
16
src/4_n_b_strlen.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include <stdio.h>
|
||||
|
||||
char *str = "Hello World!\n";
|
||||
|
||||
int main () {
|
||||
int Laenge = 0;
|
||||
char * str_pointer = str;
|
||||
|
||||
while (*str_pointer++ != '\0' ) {
|
||||
++Laenge;
|
||||
}
|
||||
|
||||
printf("%d: %s", Laenge, str);
|
||||
|
||||
return 0;
|
||||
}
|
19
src/4_p_a_swap.c
Normal file
19
src/4_p_a_swap.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void swap(int * a, int * b); /* function declaration */
|
||||
|
||||
int main() {
|
||||
int a = 4, b = 14;
|
||||
|
||||
swap(&a, &b);
|
||||
|
||||
printf("a = %d\nb = %d\n", a, b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void swap(int * a, int * b) { /* funtion implementation */
|
||||
int temp = *a;
|
||||
*a = *b;
|
||||
*b = temp;
|
||||
}
|
37
src/4_p_c_strings.c
Normal file
37
src/4_p_c_strings.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_LENGTH 81 /* 80 characters + '\0' termination */
|
||||
|
||||
int main () {
|
||||
int i;
|
||||
char str1[MAX_LENGTH]; /* Eingabestring */
|
||||
char str2[MAX_LENGTH]; /* Ausgabestring */
|
||||
char *p1, *p2;
|
||||
|
||||
printf("Bitte ein Wort eingeben: ");
|
||||
scanf(" %s", str1);
|
||||
|
||||
/* soll nur eine Ausgabe erfolgen, geht dies auch ohne str2 und zwar wie folgt: */
|
||||
printf("So soll das Ergebnis aussehen: ");
|
||||
|
||||
for (i = strlen(str1) - 1; i>=0; i--) {
|
||||
printf("%c", str1[i]);
|
||||
}
|
||||
|
||||
/* nun mit Kopie in str2: */
|
||||
p1 = str1 + strlen(str1) -1; /* p1 zeigt auf das Ende von str1 */
|
||||
p2 = str2; /* p2 zeigt auf den Anfang von str2 */
|
||||
|
||||
/* von hinten nach vorn wird str1 zeichenweise nach str2 kopiert */
|
||||
while (p1 >= str1) {
|
||||
*p2++ = *p1--;
|
||||
}
|
||||
*p2 = '\0'; /* str2 Sting-Endezeichen abschliessen */
|
||||
|
||||
/* Ausgabe beider Strings */
|
||||
printf("\n%s <--> %s\n", str1, str2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue