Rotate a matrix by 90 degree in anti-clockwise direction

C program to rotate a matrix by 90 degree in anti-clockwise direction.

Program

#include<stdio.h>
#include<conio.h>
#define MAX 10

void read_matrix(int mat[MAX][MAX], int row, int col)
{
    int i, j;
    for(i=0;i<row;i++)
    {
        for(j=0;j<col;j++)
        {
            printf("Element [%d][%d]\t:",i,j);
            scanf("%d",&mat[i][j]);
        }
    }
}

void print_matrix(int mat[MAX][MAX], int row, int col)
{
    int i, j;
    for(i=0;i<row;i++)
    {
        for(j=0;j<col;j++)
        {
            printf("%d\t",mat[i][j]);
        }
        printf("\n");
    }
}

void transpose(int mat[MAX][MAX], int rotate_mat[MAX][MAX], int row, int col)
{
    int i, j;

    for(i=0;i<row;i++)
    {
        for(j=0;j<col;j++)
        {
            rotate_mat[j][i] = mat[i][j];
        }
    }
}

void rev_col(int rotate_mat[MAX][MAX], int col, int row)
{
    int i, j, k, temp;

    for(i=0;i<row;i++)
    {
        for(j=0,k=col-1;j<k;j++,k--)
        {
            temp = rotate_mat[j][i];
            rotate_mat[j][i] = rotate_mat[k][i];
            rotate_mat[k][i] = temp;
        }
    }
}

void rotate90anticlock(int mat[MAX][MAX], int rotate_mat[MAX][MAX], int row, int col)
{
    transpose(mat, rotate_mat, row, col);
    rev_col(rotate_mat, col, row);
}

void main()
{
    int mat[MAX][MAX], rotate_mat[MAX][MAX];
    int row, col;

    printf("Enter the number of rows\t:");
    scanf("%d",&row);
    printf("Enter the number of columns\t:");
    scanf("%d",&col);

    printf("Enter the elements of the matrix\n");
    read_matrix(mat, row, col);

    printf("\nMatrix entered is\n");
    print_matrix(mat, row, col);

    rotate90anticlock(mat, rotate_mat, row, col);

    printf("\nMatrix after rotating anti clockwise 90 degree is\n");
    print_matrix(rotate_mat, col, row);

    getch();
}

Output

Enter the number of rows        :3
Enter the number of columns     :5
Enter the elements of the matrix
Element [0][0]  :1
Element [0][1]  :2
Element [0][2]  :3
Element [0][3]  :4
Element [0][4]  :5
Element [1][0]  :6
Element [1][1]  :7
Element [1][2]  :8
Element [1][3]  :9
Element [1][4]  :10
Element [2][0]  :11
Element [2][1]  :12
Element [2][2]  :13
Element [2][3]  :14
Element [2][4]  :15

Matrix entered is
1       2       3       4       5
6       7       8       9       10
11      12      13      14      15

Matrix after rotating anti clockwise 90 degree is
5       10      15
4       9       14
3       8       13
2       7       12
1       6       11