Friday, 16 May 2014

C program of sortingarray by funtion

Post By: Hanan Mannan
Contact Number: Pak (+92)-321-59-95-634
-------------------------------------------------------

            C program of sortingarray by funtion .................. ‪#‎compiler448
‪#‎include‬<stdio.h>
#include<conio.h>
void sortarray(int[], int);
int limit=10;
void main()
{
int a[10]={19,11,13,99,5,21,22,34,66,76};
sortarray(a, limit);
for(int i=0; i<limit; i++)
printf("%d\n\n", a[i]);
getch();
}
void sortarray(int a[], int l)
{
int i,j,keep;
for(i=0; i<l-1; i++)
for(j=i+1; j<l; j++)
if(a[i] > a[j])
{
keep=a[i];
a[i]=a[j];
a[j]=keep;
}
}

0 comments: