Hello there I am having trouble declaring two dimensional arrays using pointers. I am new to C.
int main(){
int x = 0;
int y = 0;
int *xdim;
int *ydim;
printf("Enter x:\n");
scanf("%d", &x);
printf("Enter y:\n");
scanf("%d", &y);
xdim = &x;
ydim = &y;
char sq[xdim][ydim];
return 0;
}
I want the two dimentionial array char sq to hold the values inputed by the user. I get error non-integer type *int. I am also new to pointers.
char sq[x][y];, you do not need xdim/ydimchar sq[*xdim][*ydim]xdim = &xifscanfdoesn't return error.