Ok, i have written this program w/ a one-dim. array, but the assignment calls for a two-dim. array. With the two-dim array on the output i get a weird negative number as follows :

Output :

1
-895433063 1

The one's are in the correct places, but the -number is screwing me up.

Here's my code :

//Global Varibles
const long int MAX_ROWS = 10;
const long int MAX_COLS = 10;

//Begin Main
void main(void)
{
//Variables
long last[MAX_ROWS][MAX_COLS];
long current[MAX_ROWS][MAX_COLS];
int x;
int y;
int size;
int find = 0;

current[1][0] = 1;
last[0][0] = 0;
last[1][0] = 1;

int a = 1;
int b = 0;

//Statements
cout << "Enter in size of triangle : ";
cin >> size;
if(size == 1)
{
printf("1\n");
}

else
{
printf("1\n");

while (1)
{
a++;
b++;
find = 0;
for (x = 1; x < a; x++)
{
for(y = 0; y < b; y++)
{
current[x][y] = last[x - 1][y] + last[x - 1][y - ];
}
}

for (x = 0; x < a; x++)
{
for(y = 0; y < b; y++)
{
last[x][y] = current[x][y];
last[a][b] = 1;
}
}
for (x = 1; x <= a; x++)
{
for(y = 1; y <= b; y++)
{
if(size < 4)
{
size = size - 1;
}

if (last[x][y] > size)
{
find = 1;
}

if (x > 1)
printf(" %ld", last[x][y]);
else
printf("%ld", last[x][y]);
}
}
printf("\n");

if(find)
{
break;
}
}// end While

}//End else

getch();

}
//End Main, End Program

-JMM