I need to write a code (in C99). The programe receives an input number (integer) 'n' and then a matrix sized n*n (matrix[n][n]), all numbers are integers. We're supposed to define the matrix's size with malloc.
Now the program needs to sort the lines of the matrix (the number in each line), in a single function (!) this way:
even line index (0,2,4,6...): from small to big.
odds line index (1,3,5...): from big to small.
and then print it.
*note: first line is indexed 0, second line is 1, etc.

I was thinking to sort it with bubblesort function with the following if:
if(i%2==1)
do odds sorting.
else
do even sorting.
when i is the index of the row.

my problem is defining the malloc and how do I send the matrix to sorting.
please help

If needed I will attach my current (not so good (completly awful)) code and functions as well as an example of what the prog. supposed to do.

*sorry for grammer.