Kommentare numbers.c
This commit is contained in:
parent
16f3961eb4
commit
38ce259cbc
@ -1,3 +1 @@
|
||||
krisp3;6987
|
||||
krisp2;4985
|
||||
krisp;3991
|
||||
krisp5;4991
|
||||
|
||||
12
numbers.c
12
numbers.c
@ -18,10 +18,14 @@
|
||||
|
||||
// typedef int (*CompareFctType)(const void *arg1, const void *arg2);
|
||||
// vergleicht zwei Werte: a<b: -1 a>b: 1 a=b: 0
|
||||
int compareUnsignedInt(const void *a, const void *b) {
|
||||
unsigned int x = *(unsigned int *)a;
|
||||
unsigned int y = *(unsigned int *)b;
|
||||
return (x < y) ? -1 : (x > y);
|
||||
int compareUnsignedInt(const void *a, const void *b) { // generischer Zeiger
|
||||
unsigned int x = *(unsigned int *)a; // Typumwandlung: void * → unsigned int *
|
||||
unsigned int y = *(unsigned int *)b; // Wert wird durch *b in y gespeichert
|
||||
if (x < y)
|
||||
return -1;
|
||||
if (x > y)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
// numbers = createNumbers(numberOfElements);
|
||||
// es wird die angefragte Länge des Arrays übergeben
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user