diff options
Diffstat (limited to 'src/hand.c')
| -rw-r--r-- | src/hand.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hand.c b/src/hand.c new file mode 100644 index 0000000..8c2a392 --- /dev/null +++ b/src/hand.c @@ -0,0 +1,16 @@ +#include "hand.h" +#include <stdlib.h> +#include "card.h" + +static int hand_comparator(const void *a, const void *b) +{ + card c1 = *(card *)a; + card c2 = *(card *)b; + + return c1 - c2; +} + +void hand_sort(hand h) +{ + qsort(h, MAX_HAND_CARDS, sizeof(card), hand_comparator); +} |
