I want to pass the 2-D subarray in C as we can pass the 1-D subarray:

I had passed the 1-D subarray as follows:

**Code**

```
#include <stdio.h>

void print_array(int *arr, int len)
{
    for (int i = 0; i < len; i++)
    {
        printf("%d ", arr[i]);
    }
}

int main(void)
{
    int arr[] = {1, 2, 3, 4, 5};
    int size = sizeof(arr) / sizeof(int);
    print_array(&arr[2], size - 2);
    return 0;
}

```

**Output**

```
3 4 5 

```

But how can I do the same for a two dimensional array?
I have a 2-D array as follows:

```
int arr[6][6] = {
        {1, 2, 3, 4, 5, 6},
        {2, 3, 4, 5, 6, 7},
        {3, 4, 5, 6, 7, 8},
        {4, 5, 6, 7, 8, 9},
        {5, 6, 7, 8, 9, 10},
        {6, 7, 8, 9, 10, 11}};

```

I want to pass the index of the `arr[1][1]` element so that I can print the sub 2-D array:

```
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9
6 7 8 9 10
7 8 9 10 11

```

I tried it as follows, but it didn't worked:

**Code**

```
#include <stdio.h>

void print_array(int row, int column, int (*arr)[column])
{
    for (int i = 0; i < row; i++)
    {
        for (int j = 0; j < column; j++)
        {
            printf("%d ", arr[i][j]);
        }
        printf("\n");
    }
}

int main(void)
{
    int arr[6][6] = {
        {1, 2, 3, 4, 5, 6},
        {2, 3, 4, 5, 6, 7},
        {3, 4, 5, 6, 7, 8},
        {4, 5, 6, 7, 8, 9},
        {5, 6, 7, 8, 9, 10},
        {6, 7, 8, 9, 10, 11}};

    print_array(5, 5, &arr[1]);
    return 0;
}

```

**Output**

```
2 3 4 5 6 
7 3 4 5 6 
7 8 4 5 6 
7 8 9 5 6 
7 8 9 10 6

```

I don't know how this output is generated also please tell me how can I achieve my goal by passing the address.

**Note:** I had passed `&arr[1]` because passing `&arr[1][1]` says `incompatible pointer type for the function argument`.

I know we can do it in other ways but, how can I pass the subarray as we can do it in 1-D array?

And if it is not possible in any way then please tell me what is the main reason behind it as the method worked for 1-D array but not for 2-D array.

Because I thought that passing `arr` is doing the same (i.e. accessing its members as `arr[0][0]` `arr[1][0]` and so on. So why not to pass the starting index of a subarray to get the entire subarray easily.