#include <stdio.h>
#include <malloc.h>

void foo( int rows, int cols, int mp[rows][cols], int D1[5][5] ) {
	for ( int r = 0; r < rows; r += 1 ) {
		for ( int c = 0; c < rows; c += 1 ) {
			printf( "%d ", mp[r][c] );
		}
		printf( "\n" );
	}
	for ( int r = 0; r < rows; r += 1 ) {
		for ( int c = 0; c < rows; c += 1 ) {
			printf( "%d ", D1[r][c] );
		}
		printf( "\n" );
	}
}
void bar( int rows, int cols, int * mp[/* cols */] ) {
	for ( int r = 0; r < rows; r += 1 ) {
		for ( int c = 0; c < rows; c += 1 ) {
			printf( "%d ", mp[r][c] );
		}
		printf( "\n" );
	}
}
int main() {
	int m[5][5];										// contiguous
	int * aa[5];										// non-contiguous

	int w[5];
	for ( int r = 0; r < 5; r += 1 ) {
		for ( int c = 0; c < 5; c += 1 ) {
			m[r][c] = r + c;
		}
	}
	foo( 5, 5, m, m );

	printf( "\n" );

	for ( int r = 0; r < 5; r += 1 ) {
		aa[r] = (int *)malloc( 5 * sizeof(int) );
		for ( int c = 0; c < 5; c += 1 ) {
			aa[r][c] = r + c;
		}
	}
	bar( 5, 5, aa );
}
