Code:
#include<stdio.h>
#include<conio.h>
void bubble(int *,int);
void main()
{
int a[40],i,j,n;
clrscr();
printf("enter the size of the array");
scanf("%d",&n);
printf("enter the sequence");
for(i=0;i<=n-1;i++)
{
scanf("%d",&a[i]);
}
printf("the sorted array is:");
bubble(&a[0],n);
for(i=0;i<=n-1;i++)
{
printf("%d\t",a[i]);
}
getch();
}
void bubble(int *a,int n)
{
int i,j,t;
for(i=1;i<=n-1;i++)
{
for(j=0;j<=n-1-i;j++)
{
if(a[j]>a[j+1])
{
t=a[j];
a[j]=a[j+1];
a[j+1]=t;
}
}
}
}



