//C program to implement
//sorting using pointers
#include <stdio.h>
//Function to sort the numbers using pointers
void sort(int n,int* ptr)
{
int i,j;
//Sort the numbers using pointers
for(i=0;i<n;i++){
for(j=i+1;j<n;j++){
if(*(ptr+j) < *(ptr+i)){
int temp = *(ptr+i);
*(ptr+i) = *(ptr+j);
*(ptr+j) = temp;
}
}
}
//print the numbers
for(i=0;i<n;i++)
printf("%d",*(ptr+i));
}
//Driver Code
int main()
{
int n=5;
int arr[]={13,22,7,12,4};
sort(n,arr);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: