Skip to content
Snippets Groups Projects
Commit 10e59583 authored by gossa's avatar gossa
Browse files

MAX au lieu de -1

parent 5fabf318
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#define MAX_VALEUR 150000 #define MAX_VALEUR 15
int *generer_tableau(long long unsigned int n) int *generer_tableau(long long unsigned int n)
{ {
...@@ -30,10 +30,10 @@ void afficher_tableau(int *tableau, long long unsigned int n) ...@@ -30,10 +30,10 @@ void afficher_tableau(int *tableau, long long unsigned int n)
} }
long long int rechercher(int *tableau, long long unsigned int n, int valeur) long long unsigned int rechercher(int *tableau, long long unsigned int n, int valeur)
{ {
long long int i; long long unsigned int i;
long long int trouve = -1; long long unsigned int trouve = -1;
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
if (tableau[i] == valeur) { if (tableau[i] == valeur) {
...@@ -74,5 +74,5 @@ int main(int argc, char *argv[]) ...@@ -74,5 +74,5 @@ int main(int argc, char *argv[])
afficher_tableau(tableau,taille); afficher_tableau(tableau,taille);
trouve = rechercher(tableau, taille, valeur); trouve = rechercher(tableau, taille, valeur);
printf("Valeur %d trouvée: %d\n",valeur, trouve); printf("Valeur %d trouvée: %u\n",valeur, trouve);
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment