#include<stdio.h>
#include<conio.h>
void bubble(int *p, int n)
{
int i, j, tmp;
for(i=0;i<n;i++)
{
for(j=0;j<n-1-i;j++)
{
if(*(p+j)>*(p+j+1))
{
tmp = *(p+j);
*(p+j) = *(p+j+1);
*(p+j+1) = tmp;
}
}
}
}
void main()
{
int a[10], i, j, tmp;
clrscr();
printf("nEnter the values for the array:");
for(i=0;i<10;i++)
{
scanf("%d", &a[i]);
}
bubble(&a[0], 10);
printf("nSorted Values are:");
for(i=0;i<10;i++)
{
printf("n%d", a[i]);
}
getch();
}
Write a program in C to input an array of size 10 and pass its address to a function Bubble which sorts it in ascending order. Print the resulting matrix
Programming