#include <stdio.h>

void swap(int* a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

void print(int m[3][3]) {
	for (int r = 0 ; r != 3 ; r++) {
	    for (int c = 0 ; c != 3 ; c++)
	        printf("%d ", m[r][c]);
	    printf("\n");
	}
}

int main(void) {
	int m[3][3] = {{1,2,3}, {4, 5, 6}, {7, 8, 9}};
    print(m);
    printf("--------\n");
    
    swap(&m[0][0], &m[2][0]);
    swap(&m[0][1], &m[1][0]);
    swap(&m[0][2], &m[2][0]);
    swap(&m[1][0], &m[2][1]);
    swap(&m[1][2], &m[2][1]);
    swap(&m[2][2], &m[2][0]);

    print(m);
	return 0;
}
