/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
void print(int(*)[2],int,int);
void sort(int(*)[2],int,int);
void modify(int(*)[2],int ,int );
int main()
{
int a[4][2]={{3,19},{11,33},{18,80},{80,100}},r,c;
r=sizeof(a)/sizeof(a[0]);
c=sizeof(a[0])/sizeof(a[0][0]);
printf("%d %d\n",r,c);
printf("before modification:= ");
print(a,r,c);
printf("\n");
modify(a,r,c);
printf("after modification\n");
print(a,r,c);
sort(a,r,c);
printf("after sorting\n");
print(a,r,c);
return 0;
}
void print(int (*a)[2],int r,int c)
{
int i,j;
for(i=0;i<r;i++)
for(j=0;j<c;j++)
printf("%d ",a[i][j]);
printf("\n");
}
void sort(int (*a)[2],int r,int c)
{
int temp;
int i,j,k;
for(i=0;i<c;i++)
for(j=0;j<=r;j++)
for(k=j+1;k<=r;k++)
if(a[i][j]>a[i][k])
{
temp=a[i][j];
a[i][j]=a[i][k];
a[i][k]=temp;
}
}
//2, 10, 17, 19, 33, 79, 80, 100
void modify(int(*a)[2],int r,int c)
{
int i,j;
for(i=0;i<r;i++)
a[i][0]--;
}