c - Assign 1 value of a 3D array to a 1D array -
i have 3d array arr1[16][8][9]
, want assign contents of array 1d array arr2[36]
. i'm trying:
arr2[0] = arr1[0][0][0]; arr2[1] = arr1[0][0][1]; ...... arr2[8] = arr1[0][0][8];
i'm calling function:
func_arr(int arr2[36], int arr1[16][8][9])
the function declaration goes like:
void func_arr(int arr2[36],int arr1[][8][9]);
but array assignment seems invalid. better approach it?
function calling seems incorrect. replace below line
func_arr(int arr2[36], int arr1[16][8][9])
with
func_arr(arr2, arr1);
type of first function argument int [36]
, passing arr2[36]
. assuming arr2 int arr2[36]
, type of arr2[36]
int
, type mis-match. arr2[36] int located @ address after arr2 ends.
Comments
Post a Comment