i stuck with my code to change this code by using a pointer. mybe someone want to help me fixed it.
this my code :
Code:
#include <stdio.h>
#define size 100
int array2d(int x[size][size], int a, int b)
{
int i, j;
for (i = 0; i < a; i++)
{
for (j = 0; j < b; j++)
{
printf("%d ", x[i][j]);
}
printf("\n");
}
}
int main()
{
int a, b;
int x[size][size];
printf("enter the size of array (row) & (column) : ");
scanf("%d %d", &a, &b);
printf("enter the number : ");
for (int i = 0; i < a; i++) //reading input
{
for (int j = 0; j < b; j++)
{
scanf("%d", &x[i][j]);
}
}
array2d(x, a, b);
return 0;
}
please help me
this code input :
2 2
and
1 2 3 4
should be an output :
1 2
3 4