Code:

#include <stdio.h>
#define row 6
#define col 6
void bubbleSort(int[row][col],int,int,char);
int main()
{
int a[row][col]={{3,4,2,1,0,-1},{5,9,4,-5,-8,7},{8,2,6,5,1,0},{1,5,6,8,0,4},{-6,-9,-4,5,8,-7},{-8,-2,6,-5,1,0}},i,y;
char dec='a';
bubbleSort(a,1,3,dec);
dec='d';
bubbleSort(a,4,6,dec);
for(i=0;i<6;i++)
{
for(y=0;y<col;y++)
{
printf("a[%d][%d]=%d\n",i,y,a[i][y]);
}
}
system("Pause");
return 0;
}
void bubbleSort(int x[row][col],int low,int high,char asc)
{
int i,y,temp,a;
for(i=low-1;i<high;i++)
{
for(a=0;a<6;a++)
{
for(y=0;y<col;y++)
{
if(asc=='a')
{
if(x[i][y]>x[i][y+1])
{
temp=x[i][y+1];
x[i][y+1]=x[i][y];
x[i][y]=temp;
}
}
if(asc=='d')
{
if(x[i][y]<x[i][y+1])
{
temp=x[i][y+1];
x[i][y+1]=x[i][y];
x[i][y]=temp;
}
}
}
}
}
}