Reputation: 1
I want to define some this:
int m=5;
int [,] matrix=new int[4,m];
Is it possible?
Upvotes: 0
Views: 112
Reputation: 2523
I have constructed array name is matrix and has dimension 3*3. You can change this code as your requirement.
int m=3
int [,] matrix = int [3,m] = {
{0, 1, 2, 3} ,
{4, 5, 6, 7} ,
{8, 9, 10 }
};
Upvotes: 0
Reputation: 308
What you have works for fixed sized. If you want a dynamic matrix then use something like
var matrix = new List<List<int>>();
Upvotes: 1