#include #include // Variables const int size=8; int *alloc_tab(){ int *tab=NULL; tab=malloc(sizeof(int)*size); tab[0]=4; tab[1]=2; tab[2]=5; tab[3]=5; tab[4]=5; tab[5]=20; tab[6]=910; tab[7]=91; return tab; } void in_tab(int tab[], int cible) { int occurence=0; for (int i=0; i < size; i++) { if (tab[i] == cible) { printf("La cible se trouve dans le tableau\n"); occurence++; } else { printf("La cible ne se trouve pas dans le tableau\n"); } } if (occurence!=0) { printf("La cible est dans le tableau, %d fois", occurence); } } int main(void) { int* tab=alloc_tab(); in_tab(tab, 5); free(tab); return 0; }