Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- void sort(int values[], int n);
- int main(void)
- {
- int values[5]={4,2,5,3,1};
- int n =5;
- void(values,n);
- for(int b=0;b<n;b++)
- {
- printf("%d\n", values[b])
- }
- }
- void sort(int values[], int n)
- {
- for (int i=0; i<n; i++)
- {
- int position=i;
- for(int j=i+1; j<=n; j++)
- {
- if (values[position]>values[j])
- position=j;
- }
- if (position!=i)
- {
- int swap= values[i];
- values[i]=values[position];
- values[position]=swap;
- }
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement