I wrote a program to calculate the tranpose of a matrix. The declaration part of my code is
Code:
int m, n; //m is the number of rows of the array and n is the number of columns of the array
int i,j;
printf("What is the order of the matrix. Input number of ROWS and COLUMNS: ");
scanf("%d%d",&m,&n);
int number[m][n];
int transpose[n][m];
I didnt want to use fixed integers in the arrays because I wanted the user to specify the order of the matrix.
The program worked well in CodeBlocks 10.05 which is the IDE I use, but when I tried to run it in Turbo C++, the program gave me an error, "Constant Expression required in function main" and the int number[m][n] line was highlighted.
Can anybody kindly explain to me why the program didnt run in Turbo C++ but worked in CodeBlocks.
I'm new to C programming, just over a month old. Thank you!