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
/* | |
Esta función regresa el índice del elemento buscado | |
dentro del arreglo; si no lo encuentra regresa -1 | |
Recibe el arreglo, la búsqueda y la longitud del arreglo, | |
recuerda que la longitud se debe pasar porque al pasar por | |
referencia no se puede obtener la longitud | |
*/ | |
int buscarEnArreglo(const int arreglo[], int busqueda, int longitud) { | |
for (int x = 0; x < longitud; x++) { | |
if (arreglo[x] == busqueda) return x; | |
} | |
return -1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment