there is some problm with this program.please tell me.

print an N*N matrix in tabular form.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# include<iostream>
# include<conio.h>
using namespace std;

void printarray(int arg[8][8],int length){
for (int n=0;n<length; n++){
	for(int j=0;j<length;j++)

cout<<arg[n][j]<<" ";

	getch();

}}

void main(){
	int n=0;
	int j=0;
	int arr[8][8];
	cout<<"["<<n<<"]["<<j<<"]"<<endl;
		printarray(arr,n);
	cout<<"\n";
	getch();
You have a couple of problems.
1) Line 18, your array is uninitialized.
2) You pass n to printarray as the length argument, but n is initialized to 0. You're not going to print anything.

Last edited on
Topic archived. No new replies allowed.