Check my code is not runningc segmentation fault

#include
#include
#include

using namespace std;

int main(){

int arr[1000][1000];
int m,n;
cin >> m >> n;

for(int i=0;i<m;i++) {
    for(int j=0;j<n;j++) {
        cin >> arr[i][j];
    }
}

int temp=0;
while(temp<n) {
    if(temp%2==0) {
        int row=0;
        while(row<m) {
            cout << arr[row][temp] << " ";
        }
    }
    else {
        int row=m-1;
        while(row>=0) {
            cout << arr[row][temp] << " ";
        }
    }
}



return 0;

}

I have edited your code… Try to submit it now…