Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
#include <stdlib.h>
-#include "sort.h"
+#include "array.h"
int create_tab(int tab[], unsigned tab_size) {
tab = malloc(sizeof(unsigned) * tab_size);
/* we suppose both tab are already created */
static void copy_tab(int src_tab[], int dest_tab[], unsigned min_tab_size, unsigned index_offset) {
+ /* FIXME: I think it's worth doing some sanity check on the array size */
for (unsigned i = 0; i < min_tab_size; i++) {
dest_tab[i + index_offset] = src_tab[i];
}
#ifndef ARRAY_H
#define ARRAY_H
+#include "sort.h"
+
int create_tab(int tab[], unsigned tab_size);
void free_tab(int tab[]);
int concat_tab(int tab1[], unsigned tab_size1, int tab2[], unsigned tab_size2, int tab_dest[]);
#include <stdlib.h>
#include <stdio.h>
+#include "array.h"
+#include "utils.h"
+
int main() {
- printf("Hello world\n");
+ int* tab = NULL;
+ create_tab(tab, 11);
+ const unsigned tab_size = ARRAY_SIZE(tab);
exit(EXIT_SUCCESS);
}