/* Ferworn F06 a simple example of passing a pointer to a 2d array to 
functions that do something to it. */

void stuffit(int [][],int,int);
void printit(int [][],int,int);

int main()
{
	int twodarray[5][5];
	
	stuffit(twodarray,5,5);
	printit(twodarray,5,5);
}

void stuffit(int array[][5],int rows, int cols)
{
	int i,j;
	for(i=0;i<rows;i++)
		for(j=0;j<cols;j++)
			array[i][j]=i*rows + j;
}

void printit(int array[][5],int rows, int cols)
{
	int i,j;
	for(i=0;i<rows;i++)
	{
		for(j=0;j<cols;j++)
			printf("%d\t",array[i][j]);

		printf("\n");
	}
}