I've seen a question on this, but I am not really understanding it as I haven't learned pointers/memory in school, and this is an assignment for school. I'm trying to write a program that takes an integer value from the user, and prints out an upper right triangle with the same leg length. I'm using an array and then storing each cell with a character depending on its coordinates. It's running fine when I compile it, but it doesn't work on my submission. Can someone explain why I'm getting the error in the title?
#include <iostream>
#include <string>
using namespace std;
int main()
{
int size, m, n;
cout << "Size";
cin >> size;
cout << endl;;
const int ARRAY_SIZE = size;
string tri_array[(ARRAY_SIZE)][(ARRAY_SIZE)];
for(m = 0; m < size; m++)
{
for(n = 0; n < size; n++)
{
if(m > n)
{
tri_array[m][n] = " ";
}
else
{
tri_array[m][n] = "*";
}
}
}
return 0;
}