Unhandled exception error in my compiler?

I'm having an issue in my array practice problem. I intialize and print out a 2D array using random numbers, and then i'm supposed to rotate it 90 degrees. I get the error:

Unhandled exception at 0xfffffffe in Exercise11_KevinNguyen.exe: 0xC0000005: Access violation.

I'm pretty new to programming, so sorry if I sound like.. a moron. I have no little red squiggly lines under my code so there aren't any errors that are "out there." My teacher says there must be an error with a pointer, but I'm not sure what he means by that. I declared all the variables used in the functions too.

Here's my code. Could anyone help me troubleshoot?

// Exercise11_KevinNguyen.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;
void print(int [][3],int n, int k);
void rotateprint(int multiarray1[][3], int multiarray2[][3]);

int main()
{
int n = 3;
int k = 3;
srand(5);
int multiarray1[3][3]= {};
int multiarray2[3][3]= {};
print(multiarray1,n,k);
rotateprint(multiarray1,multiarray2);
system("pause");
return 0;
}

void print (int multiarray1[][3],int n, int k)
{
for (int i = 0; i<n;i++)
{
for (int j = 0; j<k;j++)
{
multiarray1[i][j] = (rand()%9)+1;
cout << multiarray1[i][j];
cout << " " ;

}
cout << endl;
}

}
void rotateprint(int multiarray1[][3], int multiarray2[][3])
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; i++)
{
multiarray1[i][j] = multiarray2[2-j][i];
}
cout << endl;
}
for (int i = 0; i<3;i++)
{
for (int j = 0; j<3;j++)
{

cout << multiarray1[i][j];
cout << " " ;

}
cout << endl;
}
}


Topic archived. No new replies allowed.