Created
October 9, 2019 01:48
-
-
Save parzibyte/3f56ac458904cb46f7e1c12f56173c10 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[] = {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 a quicksort indicando todo el arreglo, desde 0 hasta el índice final | |
*/ | |
quicksort(arreglo, 0, longitud - 1); | |
/* | |
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