If you are curious on how to allocate a bidimensional array, here's a tip:
Code:
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
int i, j;
int ( *ptr )[][20]; // ptr = pointer to bidimensional array of ints.
size_t size;
// Calc 10 rows needed space on heap.
size = 10 * sizeof( int [20] );
// Using calloc() to zero the entire array...
ptr = calloc( 1, size );
//...
( *ptr )[5][5] = 10;
//...
printf( "Allocated: %zu bytes @ %p\n", size, ptr );
// show the array...
for ( i = 0; i < 10; i++ )
{
printf( "row %-2d: ", i );
for ( j = 0; j < 20; j++ )
printf( "%3d ", ( *ptr )[i][j] );
putchar( '\n' );
}
free( ptr );
}