Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created October 9, 2019 04:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/331331d293fc82ac3d6853129aaf5ab1 to your computer and use it in GitHub Desktop.
Save parzibyte/331331d293fc82ac3d6853129aaf5ab1 to your computer and use it in GitHub Desktop.
int main(void) {
// El arreglo
int arreglo[] = {30, 28, 11, 96, -5, 21, 18, 12, 22, 30, 97, -1, -40, -500};
/*
Calcular la longitud, puede ser definida por ti o calculada:
https://parzibyte.me/blog/2018/09/21/longitud-de-un-arreglo-en-c/
*/
int longitud = sizeof arreglo / sizeof arreglo[0];
/*
Imprimirlo antes de ordenarlo
*/
printf("Imprimiendo arreglo antes de ordenar...\n");
for (int x = 0; x < longitud; x++) {
printf("%d ", arreglo[x]);
}
// Un salto de línea
printf("\n");
/*
Invocar al método de la burbuja indicando todo el arreglo, desde 0 hasta el
índice final
*/
burbuja(arreglo, longitud);
/*
Imprimirlo después de ordenarlo
*/
printf("Imprimiendo arreglo despues de ordenar...\n");
for (int x = 0; x < longitud; x++)
printf("%d ", arreglo[x]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment