start of stringsort, just basic array for now.

This commit is contained in:
2026-05-29 22:25:31 +02:00
parent 2a436575a6
commit e0d044e719
2 changed files with 67 additions and 3 deletions
@@ -1,4 +1,5 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -10,7 +11,7 @@ void numberprinter(int inarr[], int arrlength) {
struct Darray {
int *digits;
int length;
size_t length; // blijkbaar correcte eenheid voor length, malloc stuff ofzo (instead of hardcoding it)
};
struct Darray *numbertodigitDarr(int input) {
@@ -25,7 +26,7 @@ struct Darray *numbertodigitDarr(int input) {
// allocate memory for struct and array, apparently more ideomatic to have a single malloc
struct Darray *DigDarr =
malloc(op * sizeof(int) + sizeof(*DigDarr) + sizeof(int));
malloc(op * sizeof(int) + sizeof(*DigDarr) + sizeof(int));
if (DigDarr == NULL) {
printf("allocation failed");
exit(0);
@@ -90,4 +91,4 @@ iterator (which has to start from 0, because we don't know the size of the
number?) then our number will be the wrong way around.
malloc, blijkbaar very different
*/
*/