searches->library[0][0] = {2, 3, 4, -1}; searches->library[1][0] = {4, 5, 6, -1}; searches->library[2][0] = {2, 3, 4, 5, 6, -1}; searches->library[3][0] = {0, 1, 2, 3, 4, 5, 6, 7, -1}; searches->library[4][0] = {0, 1, 2, -1}; searches->library[5][0] = {0, 6, 7, -1}; searches->library[6][0] = {0, 1, 2, 6, 7, -1}; searches->library[7][0] = {0, 1, 2, 3, 4, -1}; searches->library[8][0] = {0, 4, 5, 6, 7, -1}; searches->library[][9] = {{2, 3, 4, -1}, {4, 5, 6, -1}, {2, 3, 4, 5, 6, -1}, {0, 1, 2, 3, 4, 5, 6, 7, -1}, {0, 1, 2, -1}, {0, 6, 7, -1}, {0, 1, 2, 6, 7, -1}, {0, 1, 2, 3, 4, -1}, {0, 4, 5, 6, 7, -1}}; typedef struct{ int active_length; // Size of active array of searches int* active; // Active array of searches int** library; // Library of array of searches } SearchLibrary; SearchLibrary* searches; searches = (SearchLibrary *) malloc(sizeof(SearchLibrary*)); int search_cases = 9, search_directions = 9; searches->library = (int **) malloc(search_cases * sizeof(int *)); searches->active = (int *) malloc(search_directions * sizeof(int)); int i; for(i = 0; i < search_cases; i++){ searches->library[i] = (int *) malloc(search_directions * sizeof(int)); } static const int Library0[] = {2, 3, 4, -1}; static const int Library1[] = {4, 5, 6, -1}; static const int Library2[] = {2, 3, 4, 5, 6, -1}; static const int Library3[] = {0, 1, 2, 3, 4, 5, 6, 7, -1}; static const int Library4[] = {0, 1, 2, -1}; static const int Library5[] = {0, 6, 7, -1}; static const int Library6[] = {0, 1, 2, 6, 7, -1}; static const int Library7[] = {0, 1, 2, 3, 4, -1}; static const int Library8[] = {0, 4, 5, 6, 7, -1}; static const int * Library[] = { Library0, Library1, Library2, Library3, Library4, Library5, Library6, Library7, Library8, }; typedef struct{ int active_length; // Size of active array of searches const int* active; // Active array of searches const int** library; // Library of array of searches } SearchLibrary; searches->library = Library; #define SEARCH_DIRECTIONS 9 memcpy(searches->library[k], ((int [SEARCH_DIRECTIONS]){ 1, 2, 3 }), sizeof(int) * SEARCH_DIRECTIONS);