Created
October 9, 2019 04:44
-
-
Save parzibyte/331331d293fc82ac3d6853129aaf5ab1 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(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