SHIFTING THE ROW OF A 2D ARRAY. CAN YOU PLEASE TELL ME WHERE IS THE ERROR!

//row shifting in c
#include<stdio.h>
int main()
{
int arr1[4][2]={
{2,3},{1,4},{3,2},{2,2}
};
int i,j,arr2[4][2];
for(i=0;i<4;i++)
{

        if(arr1[i][0]>arr1[i+1][0])
        {
            for(j=0;j<2;j++)
            {
                arr2[i][j]=arr1[i][j];
                arr1[i][j]=arr1[i+1][j];
                arr1[i+1][j]=arr2[i][j];
            }
        }
    }
    int ii,jj;
    for(ii=0;ii<4;ii++)
    {
        for(jj=0;jj<2;jj++)
        {
            printf("%d\t",arr1[ii][jj]);
        }
        printf("\n");
    }
}

Sorry but can you explain what kind of shifting are you trying to do?

ok am sorry for not explaining it correctly

input
2 3
1 4
3 2
2 2

THEN OUTPUT
1 4
2 3
2 2
3 2

Now i have corrected my error
correction :- for(ii=0;ii<3;ii++)

It sounds like you have to sort it in increasing order on the basis of x coordinate?