Sencilla implementación del algoritmo de ordenamiento "burbuja":
#include <stdio.h>
#include <stdlib.h>
void ordenar_array(int *, int);
int main() {
int array[9]={5, 7, 7, 8, 5, 8, 1, 9, 3};
ordenar_array(array, 9);
int x;
for(x=0; x<9; x++) {
}
}
void ordenar_array(int * array, int numero_elementos) {
int x, n, aux;
for(n=1; n<numero_elementos; n++) {
for(x=0; x<numero_elementos-1; x++) {
if(array[x+1]<array[x]) {
aux=array[x];
array[x]=array[x+1];
array[x+1]=aux;
}
}
}
}