18 Bus error (core dumped) ./exe

Sir/Mam, for some reason I am getting an error which states as 18 Bus error. I tried unlocking the solution but still, it says the same.
#include
using namespace std;
int main() {
int nRow,nCol;
cin >> nRow >> nCol;

int a[nRow][nCol];

//Take Input
for (int i = 0; i < nRow; i++) {
for (int j = 0; j < nCol; j++) {
cin >> a[i][j];
}
}
//Iterating over each column
for (int j = 0; j < nCol; j++) {

//for odd columns printing elements of rows from max row to min row
//for even columns printing elements of rows from min row to max row
//Thus forming a wave pattern.
if( j%2!=0){
//for odd column
for (int i = nRow-1; i >= 0; i–) {
cout << a[i][j] << ", ";
}
}else{
//for even column
for (int i = 0; i < nRow; i++) {
cout << a[i][j] << ", ";
}
}
}
cout << “END” <<endl;
}

Even my solution was the same as sir explained.

plz send the link of your code

  1. paste your code in https://ide.codingblocks.com/
  2. file -> save-> link generated -> now share the link

at line no 20 you have to decrease row
correct statement
for(int row=M-1;row>=0;row–){
Modified Code

you have to print “END” at the end as well
and also print space after ,(comma)

yes sir. but still shows the same error. its working fine in coding blocks ide.

recheck the code i have provided
i have tested your code
it is passing all testcases

at which platform or ide it is giving error?

Got it sir. Initially it was showing error while compiling but when i submitted it passed all test cases. Thank you.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

plz give feedback here