Bonjour a toutes et a tous ,
Avec ce code , je souhaite passer l’adresse de la fonction" tri" a la fonction “affiche”pour que cette derniere puisse l'appeler par la suite. Mais je n’y arrive pas , mes yeux sont hs et j’ai besoin de votre aide
Voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#define TAILLE 5
int tri(int *tab,int tailletab);
void affiche(int(*pf),int *tab);
 
int main(void){
int i;
int tab[5];
int(*pf)(int);
pf=&tri;
 
printf("Entrez 5 chiffre:\n");
for(i=0;i<TAILLE;i++)
scanf("%d",&tab[i]);
printf("chiffres entré:\n");
for(i=0;i<TAILLE;i++)
printf("%d\n",tab[i]);
affiche(pf,tab);
return 0;
}
/*------------------------------*/
int tri(int *tab,int tailletab){
 int i,j,temp;
 for(i=0;i<TAILLE;i++)
 {
  for(j=i+1;j<TAILLE;j++)
  {
   if(tab[j]<tab[i])
   {
    temp=tab[i];
    tab[i]=tab[j];
    tab[j]=temp;
   }
  }
 }
 return *tab;
}
/*----------------------------*/
void affiche(int(*pf),int *tab){
 int i;
 int tab1[TAILLE];
 
 printf("Tableau apres classement:\n");
 for(i=0;i<TAILLE;i++)
 {
  printf("%d\n",tab1[i]);
 }
}