All pastes #45756 Raw Edit

Untitled

public text v1 · immutable
#45756 ·published 2006-03-14 22:47 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>
int main () {
	int vetor[5] = {1, 2, 3, 4, 5}, numero;
	printf ("Digite o numero que quer pesquisar.\n");
	scanf ("%d", &numero);
	if (membroQR (vetor, numero) == 0) {
		printf ("Nao encontrado!\n");
	}
	if (membroQR (vetor, numero) == 1) {
		printf ("Encontrado!\n");
	}
}
int membroQR (int *vetor, int i) {
	printf ("%d\n", *vetor);
	if (vetor == NULL) {
		return (0);
	}
	else {
		if (*vetor == i) {
			return (1);
		}
		else {
			vetor++;
			return membroQR (vetor, i);
		}
	}
}