I have to write the function vec_to_mat (int *v, int *mat, int n); v is a pointer to the beginning of an integer array (vector) with n x n elements stored in column-major representation (see below for explanation). The function should copy the elements from v to mat (which is a matrix of size n x n). From example,

If v is {1, 2, 3, 4, 5, 6, 7, 8, 9}, the value of mat should be,

1 4 7
2 5 8
3 6 9

The values 1, 2, and 3 go down the first column of matrix mat, and then 4, 5, 6 goes down the second column and so on.

This is what I have so far but it's giving me a compiler error:

Code:
#include<stdio.h>
#include<conio.h>

main()
{
vector_to_matrix ( int * vector , int * matrix , int row_length )
{
     int i , j , k;
     int column_length = row_length;
     i = k = 0;

     while ( i < row_length )
     {
        j = 0;
        while ( j <  column_length )
        {
           matrix [(row_len * j++) + i ] = vector [ k ++ ];
        }
        i++;
     }
     return 0;
     getch()
}
BTW, I have to use pointer arithmetic (not array subscripting) to visit the array elements. Someone, please help me