I want to take user input for a 2D array using pointer name
Let's say I have a 2D array named arr1[3][3] and the pointer variable name is ptr1. Is it possible use scanf with the pointer variable name? Check the code below. I am using ptr1+row+column in a nested loop
`#include <stdio.h>
int main(void)
{
int arr1[3][3];
int *ptr1 = &arr1[3][3];
for (int row = 0; row < 3; row++)
{
for (int column = 0; column < 3; column++)
{
scanf("%d", (ptr1 + row) + column);
}
}
}`
I know I could have taken input using scanf("%d", (*(arr1 + i) + j)); Thank you!