Forums Rue-Montgallet.com
Rue-Montgallet.comRue-Hardware.comRue-Occasion.comRue-DVD.comRue-Jeuxvideo.comRue-AudioVideo.comRue-Telephone.comForums
S'inscrire | S'identifier |
| Recherche avancée | Aide
 
 

Il y a 85 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici

 Mot :   Pseudo :  
 
Bas de page
Auteur
 Sujet :

Warning => D'où viennent-ils?

 
n°6678
Goldberg
Profil : Jeune recrue
Posté le 17-02-2004 à 23:53:57  profilanswer
 

Qd je complie mon prog j'ai deux warning qui apparaissent...d'où viennent-ils?
 
I:\C\bin>gcc --std=c99 -Wall -W --pedantic maite.c
maite.c: In function `tab':
maite.c:35: warning: type of `n' defaults to `int'
maite.c: In function `tri':
maite.c:45: warning: type of `n' defaults to `int'
 

Code :
  1. #include <stdio.h>
  2. /* ------------------------------------------------------------------------ */
  3. void PrintDescription(void)
  4. /* Affiche des informations concernant le crible d'Eratosthene sur la */
  5. /* sortie standard. */
  6. {
  7. printf( "------------------------------------------------------\n" );
  8. printf( "Crible d'Eratosthene\n" );
  9. printf( "------------------------------------------------------\n" );
  10. printf( "Cette methode permet d'obtenir la liste des nombres\n" );
  11. printf( "premiers inferieurs a n.\n" );
  12. printf( "------------------------------------------------------\n" );
  13. }
  14. void tab(n)
  15. { int i=0,a=2;
  16.   printf("\n" );
  17.   int B[n];
  18.   printf("premier tableau, ts les nombres\n" );
  19.   while (a<=n) {B[i]=a; ;printf( "%d ", B[i]); a=a+1;i=i+1;};
  20. }
  21. void tri(n)
  22. { int  b, cpt=0,a;
  23.         printf("\n" );
  24.         printf("\n" );
  25.         int B[n];
  26.         printf("deuxieme tableau, rien que les nombres premiers\n" );
  27.        
  28. for(a=2;a<=n;a++) {B[a]=a;}
  29. for (a=2;a<=n;a++)   
  30. {if (B[a]!=0) {for(b=a+1;b<=n;b++)
  31.                                  {if ((B[b]!=0) & (B[b]%a==0)) {B[b]=0;}}
  32.                                
  33.               }           
  34. }
  35. for (a=2;a<=n;a++) {if (B[a]>0) {cpt++;printf("%d ", B[a]);}
  36.                    
  37.                    
  38.                     ;}
  39.                    
  40. printf("\n" );     
  41. if ( cpt<=1) {printf("\n%d nombre premier au total\n", cpt);};
  42. if ( cpt>1) {printf("\n%d nombres premiers au total\n", cpt);};
  43.          
  44. }

n°6679
Goldberg
Profil : Jeune recrue
Posté le 17-02-2004 à 23:55:04  profilanswer
 

oups sorry ds le prog
 
[/cpp]#include <stdio.h>
 
/* ------------------------------------------------------------------------ */
 
 
 
 
void PrintDescription(void)
 
/* Affiche des informations concernant le crible d'Eratosthene sur la */
 
/* sortie standard. */
 
{
 
printf( "------------------------------------------------------\n" );
 
printf( "Crible d'Eratosthene\n" );
 
printf( "------------------------------------------------------\n" );
 
printf( "Cette methode permet d'obtenir la liste des nombres\n" );
 
printf( "premiers inferieurs a n.\n" );
 
printf( "------------------------------------------------------\n" );
 
}
 
 
 
 
 
void tab(n)
{ int i=0,a=2;
  printf("\n" );
  int B[n];
  printf("premier tableau, ts les nombres\n" );  
  while (a<=n) {B[i]=a; ;printf( "%d ", B[i]); a=a+1;i=i+1;};
 
}
 
 
void tri(n)
 { int  b, cpt=0,a;
        printf("\n" );  
        printf("\n" );
        int B[n];
        printf("deuxieme tableau, rien que les nombres premiers\n" );
         
 
 
for(a=2;a<=n;a++) {B[a]=a;}
for (a=2;a<=n;a++)    
{if (B[a]!=0) {for(b=a+1;b<=n;b++)
                                 {if ((B[b]!=0) & (B[b]%a==0)) {B[b]=0;}}
                                 
 
              }              
}
for (a=2;a<=n;a++) {if (B[a]>0) {cpt++;printf("%d ", B[a]);}  
                     
                     
                    ;}
 
                     
printf("\n" );        
if ( cpt<=1) {printf("\n%d nombre premier au total\n", cpt);};  
if ( cpt>1) {printf("\n%d nombres premiers au total\n", cpt);};  
 
           
}  
 
 
 
 
 
 
 
 
 
int main()
{int choix, n;
PrintDescription();
 
 while (1)
          {printf("\n1) Crible\n2) Quit\n" );
           printf("\n" );
           scanf("%d", &choix);
           switch(choix) { case 1 : printf("\nchoix n = ?\n " );
                                    printf("\n" );
                                    scanf("%d", &n);
                                   
                                    if (n<2) {printf("\n" );printf("He oh quel est l'interet de chercher les nombres premiers inferieurs a 2?\n" );
                                              break;};
                                    tab(n), tri(n);break;
                           default : printf("\n" );printf("Au revoir\n" );return 0;
                         }
           }
}
 
[cpp]

n°6680
Goldberg
Profil : Jeune recrue
Posté le 17-02-2004 à 23:55:34  profilanswer
 

Code :
  1. #include <stdio.h>
  2. /* ------------------------------------------------------------------------ */
  3. void PrintDescription(void)
  4. /* Affiche des informations concernant le crible d'Eratosthene sur la */
  5. /* sortie standard. */
  6. {
  7. printf( "------------------------------------------------------\n" );
  8. printf( "Crible d'Eratosthene\n" );
  9. printf( "------------------------------------------------------\n" );
  10. printf( "Cette methode permet d'obtenir la liste des nombres\n" );
  11. printf( "premiers inferieurs a n.\n" );
  12. printf( "------------------------------------------------------\n" );
  13. }
  14. void tab(n)
  15. { int i=0,a=2;
  16.   printf("\n" );
  17.   int B[n];
  18.   printf("premier tableau, ts les nombres\n" );
  19.   while (a<=n) {B[i]=a; ;printf( "%d ", B[i]); a=a+1;i=i+1;};
  20. }
  21. void tri(n)
  22. { int  b, cpt=0,a;
  23.         printf("\n" );
  24.         printf("\n" );
  25.         int B[n];
  26.         printf("deuxieme tableau, rien que les nombres premiers\n" );
  27.        
  28. for(a=2;a<=n;a++) {B[a]=a;}
  29. for (a=2;a<=n;a++)   
  30. {if (B[a]!=0) {for(b=a+1;b<=n;b++)
  31.                                  {if ((B[b]!=0) & (B[b]%a==0)) {B[b]=0;}}
  32.                                
  33.               }           
  34. }
  35. for (a=2;a<=n;a++) {if (B[a]>0) {cpt++;printf("%d ", B[a]);}
  36.                    
  37.                    
  38.                     ;}
  39.                    
  40. printf("\n" );     
  41. if ( cpt<=1) {printf("\n%d nombre premier au total\n", cpt);};
  42. if ( cpt>1) {printf("\n%d nombres premiers au total\n", cpt);};
  43.          
  44. }
  45. int main()
  46. {int choix, n;
  47. PrintDescription();
  48. while (1)
  49.           {printf("\n1) Crible\n2) Quit\n" );
  50.            printf("\n" );
  51.            scanf("%d", &choix);
  52.            switch(choix) { case 1 : printf("\nchoix n = ?\n " );
  53.                                     printf("\n" );
  54.                                     scanf("%d", &n);
  55.                                  
  56.                                     if (n<2) {printf("\n" );printf("He oh quel est l'interet de chercher les nombres premiers inferieurs a 2?\n" );
  57.                                               break;};
  58.                                     tab(n), tri(n);break;
  59.                            default : printf("\n" );printf("Au revoir\n" );return 0;
  60.                          }
  61.            }
  62. }


 
 
voilà tt mes excuses
 

n°6683
paxcal
Profil : Membre
Posté le 18-02-2004 à 01:16:36  profilanswer
 

Salut,
 
Essaye de typer tes paramêtre de fonctions :
 

Code :
  1. void tab(int n)
  2. ...
  3.   void tri(int n)


 
Pascal

n°6688
Goldberg
Profil : Jeune recrue
Posté le 18-02-2004 à 09:48:24  profilanswer
 

oui ça marche merci bcp


Aller à :
Ajouter une réponse