[C] Message

Résolu/Fermé
Tachiarel Messages postés 7 Date d'inscription vendredi 21 septembre 2007 Statut Membre Dernière intervention 2 novembre 2007 - 12 oct. 2007 à 17:49
Tachiarel Messages postés 7 Date d'inscription vendredi 21 septembre 2007 Statut Membre Dernière intervention 2 novembre 2007 - 12 oct. 2007 à 22:35
Bonjour,
Etudiant en informatique, je cherche à créer un programme de tri par insertion.
Cependant, mon compilateur GCC m'affiche, à la compilation, "two or more data types in declaration of 'trierSelection'", ligne 21.
Voici mon code :



#include <stdio.h>
#include <stdlib.h>
#define TAILLE_TABLEAU 10000
#define MAXIMUM 9999

int* genererTableau(int* tab, int taille)
{
    int i, intBuffer ;
    for(i = 0 ; i < taille ; i++)
    {
        intBuffer = MAXIMUM*rand() ;
        tab[i] = intBuffer ;
    }
    tab[taille] = '\0' ;
    return tab ;
}

void

void trierSelection(int tab[], int taille)
{
    int i, j, minLocal ;
    for(i = 0 ; i < taille ; i++)
    {
        minLocal = tab[i+1] ;
        for(j = i+1 ; j < taille ; j++)
        {
            if(tab[j] < minLocal)
                minLocal = tab[j] ;
        }
        tab[i+1] = minLocal ;
    }
}

void copierTableau(int* tab1, int* tab2, int taille)
{
    int i ;
    for(i = 0 ; i <= taille ; i++)
    {
        tab1[i] = tab2[i] ;
    }
}

void imprimer(int tab1[], int tab2[])
{
    int i ;
    for(i = 0 ; tab1[i] != '\0' || tab2[i] != '\0' ; i++)
    {
        printf("%d\t%d\n", tab1[i], tab2[i]) ;
    }
}



int main()
{
    int arrayBuffer[TAILLE_TABLEAU] ;
    int tableauEtudie[TAILLE_TABLEAU] ;
    genererTableau(arrayBuffer, TAILLE_TABLEAU) ;
	copierTableau(tableauEtudie, arrayBuffer, TAILLE_TABLEAU) ;
	trierSelection(tableauEtudie, TAILLE_TABLEAU) ;
	imprimer(arrayBuffer, tableauEtudie) ;
	return 0;
}



Verriez-vous où est l'erreur ?


Merci.
A voir également:

2 réponses

ShaBoo Messages postés 392 Date d'inscription mercredi 12 septembre 2007 Statut Membre Dernière intervention 5 septembre 2009 50
12 oct. 2007 à 21:05
#include <stdio.h>
#include <stdlib.h>
#define TAILLE_TABLEAU 10000
#define MAXIMUM 9999

int* genererTableau(int* tab, int taille)
{
    int i, intBuffer ;
    for(i = 0 ; i < taille ; i++)
    {
        intBuffer = MAXIMUM*rand() ;
        tab[i] = intBuffer ;
    }
    tab[taille] = '\0' ;
    return tab ;
}

void
 il sert à quoi ce void ?


void trierSelection(int tab[], int taille)
{
    int i, j, minLocal ;
    for(i = 0 ; i < taille ; i++)
    {
        minLocal = tab[i+1] ;
        for(j = i+1 ; j < taille ; j++)
        {
            if(tab[j] < minLocal)
                minLocal = tab[j] ;
        }
        tab[i+1] = minLocal ;
    }
}

void copierTableau(int* tab1, int* tab2, int taille)
{
    int i ;
    for(i = 0 ; i <= taille ; i++)
    {
        tab1[i] = tab2[i] ;
    }
}

void imprimer(int tab1[], int tab2[])
{
    int i ;
    for(i = 0 ; tab1[i] != '\0' || tab2[i] != '\0' ; i++)
    {
        printf("%d\t%d\n", tab1[i], tab2[i]) ;
    }
}



int main()
{
    int arrayBuffer[TAILLE_TABLEAU] ;
    int tableauEtudie[TAILLE_TABLEAU] ;
    genererTableau(arrayBuffer, TAILLE_TABLEAU) ;
	copierTableau(tableauEtudie, arrayBuffer, TAILLE_TABLEAU) ;
	trierSelection(tableauEtudie, TAILLE_TABLEAU) ;
	imprimer(arrayBuffer, tableauEtudie) ;
	return 0;
}
0
Tachiarel Messages postés 7 Date d'inscription vendredi 21 septembre 2007 Statut Membre Dernière intervention 2 novembre 2007
12 oct. 2007 à 22:35
Ah mais ouaiiiiiiiiis !!!!
Trop con...

J'ai dû faire une erreur dans la syntaxe.
Merciiiii !
0