Created
March 18, 2017 21:55
-
-
Save Florencia-97/272d13b5b0ec5570809b629f10d4d652 to your computer and use it in GitHub Desktop.
Vec_din
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
bool vector_guardar(vector_t* vector, size_t pos, int valor){ | |
//si accede a una posicion invalida en el vector | |
if ((pos<0) || (pos>=vector->tam)){ | |
return false; | |
} | |
//ahora si puede hacer la acción pedida | |
vector->datos[pos]=valor; | |
return true; | |
} | |
bool vector_obtener(vector_t* vector, size_t pos, int* valor){ | |
if ((pos<0) || (pos>=vector->tam)){ | |
return false; | |
} | |
int dato=vector->datos[pos]; | |
*valor=dato; | |
return true; | |
} | |
size_t vector_obtener_tamanio(vector_t* vector){ | |
return vector->tam; | |
} | |
void vector_destruir(vector_t* vector){ | |
free(vector->datos); | |
free(vector); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment