# Thread: Copying From Single Dimension Array To Multiple Dimension Array

1. ## Copying From Single Dimension Array To Multiple Dimension Array

I am currently trying to copy the contents from a single dimension array to a multiple dimension array using pointer notation. I though am having problems doing so. Can someone out there show me how to program a multiple dimension array that will take from a single dimension array? Listed below is sample code that I am trying to get to work.

Code:
```#include <stdio.h>
#define SIZE 5
#define SIZE2 5
#define ROWS 2

void transarr4(int *(*(arry)), int * arry2, int row);		//Pointer Notation (Multiple Dimension Array)

int main(void)
{
int arr[SIZE] = {100,200,300,400,500};
int arr2[ROWS][SIZE2] = {{},{}};
int *(*(arr3)) = 0;

transarr4(arr3,arr,ROWS);				//Pointer Notation (Multiple Dimension Array)

return 0;
}

//====================================================================================================
//	Pointer Notation (Multi-Dimension Array)
//====================================================================================================
void transarr4(int *(*(arry)), int * arry2, int row)
{
int num = 0;
int r = 0;
int c = 0;
for(r = 0; r < row; r++)
{
for(c = 0; c < SIZE2; c++)
{
//arr[r][c] = arr2[c];
*(*(arry)) = arry2[c];
printf("%d",*(*(arry + r)+c));
printf("\n");
}
}

}```

2. Code:
`  int arr2[ROWS][SIZE2] = {{},{}};`
Not in standard C. Find your compiler documentation how to enforce standard mode.(say gcc -std99)

Code:
`  int *(*(arr3)) = 0;`
or simply int **arr3; // it's pointer to pointer

Still not clear how you want to copy.
I think you better get yourself familiar with pointer and array first.

3. Multi-dimension arrays, are simply "arrays of arrays". So it's quite simple. Send your copy function the address of the dimension you want to work with.

Then, it's just like working with any other array.

For instance, with a 2D array, you'd send it the address to the row that you want to work on (because you're working with just 1 dimension).

With a 3D array, you'd send the address of the page (the first dimension) of the 2D array, that you wanted to work on), etc.

You need to set array3 to the right address, not just 0.