#include <stdio.h>

// r: Consider a[0] like a row. (C uses row major)

// c: Consider a[0] like a column. (C uses column major)

void r_rowmajor(int a[2][3])
{
	printf("r_rowmajor:");
	for (int c = 0; c < 2; c++)
		for (int r = 0; r < 3; r++)
			printf(" %d", a[c][r]);
	puts("");
}

void r_colmajor(int a[2][3])
{
	printf("r_colmajor:");
	for (int r = 0; r < 3; r++)
		for (int c = 0; c < 2; c++)
			printf(" %d", a[c][r]);
	puts("");
}

void c_rowmajor(int a[2][3])
{
	printf("c_rowmajor:");
	for (int c = 0; c < 3; c++)
		for (int r = 0; r < 2; r++)
			printf(" %d", a[r][c]);
	puts("");
}

void c_colmajor(int a[2][3])
{
	printf("c_colmajor:");
	for (int r = 0; r < 2; r++)
		for (int c = 0; c < 3; c++)
			printf(" %d", a[r][c]);
	puts("");
}

int main(void)
{
	int a[2][3] = {
		{ 1, 2, 3 }, { 4, 5, 6 },
	};

	c_rowmajor(a);
	c_colmajor(a);
	r_rowmajor(a);
	r_colmajor(a);
}