Answer to Question #313615 in C++ for Simon

Question #313615

What is the syntax for a multi dimensional array and a two dimensional array ?

1
Expert's answer
2022-03-19T02:24:17-0400
using namespace std;




#define N 4
int main()
{
	int r,c,X;
	int Matrix[N][N]= 	{
						{2, 0, 3, 4},
						{1, 3, 15, 6},
						{2, 0, 9, 8},
						{3, 4, 5, 6}
					};
	cout<<"\n\tMulti-dimensional Array:\n";
	for(r=0;r<N;r++)    
	{
		for(c=0;c<N;c++)
		{
			cout<<"\t"<<Matrix[r][c];
		}
		cout<<endl;
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog