I have problem when i tiping numer larger then 4. Program crashes and I don't know what is the problem. Program do smth like:

1

1 1

1 1

1 1 1

1 1 1

1 1 1

while matrix will be lenght x lenght size.

here is code:

Code:#include <stdio.h> #include <conio.h> #include <stdlib.h> #include <math.h> //create piramide void pyramid( int length) { int j = 1, x=1, y=1, i, k=length, l=1, a[x][y]; while ( k > 0 ){ for ( x = 0; x < l; x++) for ( y = 0; y <l; y++) a[x][y]=rand()%200; for ( y = 0; y <l; y++){ for ( x = 0; x <l; x++) printf ( "%d ", a[x][y]); printf (" \n"); } k--; l++; x=1; y=1; printf (" \n"); } } //main int main( ) { int length; printf( "write piramide lenght:" ); scanf( "%d", &length ); pyramid (length); getch( ); return 0; }