As for as my knowledge,u can't initialize a variable of any datatype in any part of the program expect at the beginning.
Please do correct me if am wrong .
This should help ypu,
Code:
void main()
{
int row,col,mat[50][50],i,j;
printf ("Please enter the matrix height ( number of rows ) :\n");
printf ("Please enter the matrix height ( number of rows ) :\n");
scanf ("%d", &row);
while (row < 2 || row > 15)
{
printf ("Wrong input, the matrix height must be between 2 and 15 - try again :\n");
scanf ("%d", &row);
}
printf ("Please enter the matrix width ( number of columns ) :\n");
scanf ("%d", &col);
while (col < 2 || col > 15)
{
printf ("Wrong input, the matrix width must be between 2 and 15 - try again :\n");
scanf ("%d", &col);
}
// Entering Elements inside the Matrix.
for(i=0;i<row;i++)
for(j=0;j<col;j++)
scanf("%d",&mat[i][j]);
// Printing the Elements inside the Matrix.
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
matrix("%d\t",mat[i][j]);
printf("\n") ;
}
getch();
}
~FT