Program to Sort the Elements using function

#include<stdio.h>
void sort(int m,int x[ ])
{
int i,j,t;
for(i=1;i<=m-1;i++)
{
for(j=1;j<=m-i;j++)
{
if(x[j-1]>=x[j])
{
t=x[j-1];
x[j-1]=x[j];
x[j]=t;
}
}
}

void main()
{
int x,i,g[10],n;
printf("enter the number of elements for sorting");
scanf("%d",&n);
printf("enter the elements\n");
for(i=0;i<=n;i++)
{
scanf("%d",&g[i]);
}
x=sort(g[i])
printf("\n the sorted elements is\n");
for(i=0;i<=n;i++)
{
printf("%d",g[i]);
}
getch();
clrscr();
}

Comments

Popular posts from this blog

Visti Cloud Service (VCS)

Being a DARK SKINNED is not a PROBLEM