Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ordenamiento(int a[], int n)
- //a es el arreglo a ordenar y n la cantidad de números que tiene (como fue declarado: a[n])
- //es void porque al pasar el arreglo pasa por referencia
- {
- int i, j, min, tmp;
- for(i=0; i<n-1; i++)
- {
- min=i;
- for(j=i+1;j<n; j++)
- {
- if(a[j]<a[min])
- {
- min=j;
- }
- }
- tmp=a[i];
- a[i]=a[min];
- a[min]=tmp;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment