Created
January 13, 2013 15:17
-
-
Save rayyee/4524559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
int i = 0, a[10] = {1,21,54,5848,46,4,15,415,4,45}; | |
int *pa = a+3; | |
sort(pa, 6); | |
for (;i < 6; i += 1) | |
{ | |
printf("%d%s", pa[i], ","); | |
} | |
return 0; | |
} | |
void sort(int *name, int n) | |
{ | |
int *temp; | |
int i,j,k; | |
for (i=0;i<n-1;i++) | |
{ | |
k=i; | |
for (j=i+1;j<n;j++) | |
{ | |
if (name[k] > name[j]) k=j; | |
if (k!=i) | |
{ | |
temp=name[i]; | |
name[i]=name[k]; | |
name[k]=temp; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment