Can any one tell me why I receive a System.IndexOutOfRangeException from this code?
char[,] matrix = new char[80, 18];
for (int i = 0; i < 80; i++)
    for (int j = 0; i < 18; j++)
        matrix[i, j] = '1';
Can any one tell me why I receive a System.IndexOutOfRangeException from this code?
char[,] matrix = new char[80, 18];
for (int i = 0; i < 80; i++)
    for (int j = 0; i < 18; j++)
        matrix[i, j] = '1';
 
    
    You are checking if i is smaller than 18 in the second for loop
char[,] matrix = new char[80, 18];
for (int i = 0; i < 80; i++)
    for (int j = 0; i < 18; j++) //<-- Right there.
        matrix[i, j] = '1';
Change to:
char[,] matrix = new char[80, 18];
for (int i = 0; i < 80; i++)
    for (int j = 0; j < 18; j++) //<-- Right there.
        matrix[i, j] = '1';
 
    
    Problem : in your second for loop you are checking with variable i instead of j 
for (int i = 0; i < 80; i++)
for (int j = 0; i < 18; j++)
               ^^^ should be j
Try This:
for (int i = 0; i < 80; i++)
for (int j = 0; j < 18; j++)
