I'm trying to create a function that modifies a 2D array...
I'm trying to write a function that inputs an array of 65 elements (ArrA[65]) and a two-dimensional array of Nx65 elements (ArrB[N][65]) and returns the two dimensional array with the one dimensional array appended to the end. I'm keeping track of N in the index ArrB[0][0] (with the rest of the first row full of -1s). I know I'm going to have to malloc/calloc something, but I'm not sure how to prevent the new value from being a local variable. Any ideas?
Would I need to do something like create a temporary array (ArrC) the size of ArrB, then do
Code:
ArrB = (int*) calloc( (N+1)*65, sizeof(int));
Then just iterate through assigning all of the values of ArrC to it and assign ArrA at the end?
Sorry, I'm not sure how to make sure ArrB stays a 2D array. Any help is greatly appreciated!