Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- void getMaiorEMenor(int vetor[], int *menor, int *maior) {
- int aux;
- int index;
- for (index = 0; index < sizeof(vetor); index++) {
- int current = vetor[index];
- if (current > *maior) {
- *maior = current;
- }
- if (current < *menor) {
- *menor = current;
- }
- }
- }
- int main(int argc, char const *argv[]) {
- int numeros[4] = {2, 5, 1, 4};
- int maior, menor;
- getMaiorEMenor(numeros, &menor, &maior);
- printf("%d %d\n", menor, maior);
- }
Advertisement
Add Comment
Please, Sign In to add comment