#include
using namespace std;
void Bubble_sort(int a, int n){
for(int i=0; i<n-1; i++){
for(int j=0; j<n-i-1; j++){
if((a+j)>(a+j+1)){
swap((a+j),*(a+j+1));
}
}
}
}
void printArray(int a,int n){
for(int i=0; i<n; i++){
cout<<(a+i)<<" ";
}
}
int main()
{
int a[]={3,7,9,11,23,48};
int n=sizeof(a)/sizeof(int);
cout<<"before SORTING : "<<endl;
printArray(a,n);
cout<<endl;
Bubble_sort(a,n);
cout<<"after SORTING : "<<endl;
printArray(a,n);
return 0;
}
-----> after sorting’s output is same as printarray,
o/p–>
before SORTING :
3 7 9 11 23 48
after SORTING :
3 7 9 11 23 48