预期'struct CELLULE **'但参数类型为'struct CELLULE'

时间:2017-01-15 00:37:38

标签: c

大家好,我希望大家都好,

我在这里搜索一些帮助因为,我有一点问题,当我尝试编译我的程序时,我在函数main中有一个错误在这行d = DEPILER(* p);

错误是

main.c:12:19: error: incompatible type for argument 1 of ‘DEPILER’
        p = DEPILER(*p);
               ^
In file included from Indexation.h:4:0,
             from base.h:1,
             from main.c:3:
PileID.h:18:9: note: expected ‘struct CELLULE **’ but argument is of type ‘struct CELLULE’
 Pile_ID DEPILER (Pile_ID *p);
     ^
main.c:14:21: error: incompatible type for argument 1 of ‘DEPILER’
     }while( DEPILER(*p) != NULL);
                 ^
In file included from Indexation.h:4:0,
             from base.h:1,
             from main.c:3:
PileID.h:18:9: note: expected ‘struct CELLULE **’ but argument is of type ‘struct CELLULE’
 Pile_ID DEPILER (Pile_ID *p);
     ^
Makefile:12 : la recette pour la cible « main.o » a échouée
make: *** [main.o] Erreur 1

我经常搜索,找出为什么我的计划不起作用,但我不知道因为

的论点
  

d = DEPILER(* p);

  

* P

类型

  

Pile_ID

我的DEPILER原型是

  

识别DEPILER(Pile_ID * p);

所以为什么他想要一个类型

的论证
  

struct CELLULE **

//我的主要

#include <stdio.h>
#include <stdlib.h>
#include "base.h"

int main(){

    Pile_ID p;
    identifiant d;

    p = Indexation("/home/mallent/FICHIER_PROJET/Textes");
    do{
      d = DEPILER(*p);
      //Copie(*d);
    }while( DEPILER(*p) != NULL);
}


// function depiler in file PileID.c

identifiant DEPILER (Pile_ID *p){
    assert(PILE_EST_VIDE);
    identifiant x;
    Pile_ID paux;
    paux=(*p)->suiv;
    x.d=(*p)->ID.d;
    x.titre=(*p)->ID.titre;
    free (*p);
    (*p)=paux;
    return x;
}


// function depiler in file PileID.h
#include "descripteur.h"
typedef struct etIdentifiant{
    descrip d;
    const char *titre;
}identifiant;

typedef struct CELLULE{
    identifiant ID;
    struct CELLULE *suiv;
}Cel;

typedef struct CELLULE * Pile_ID;

PS:对不起我的英文我希望你能理解感谢所有会帮助我的人(^ _ ^)

1 个答案:

答案 0 :(得分:1)

尝试使用d = DEPILER(&p);代替d = DEPILER(*p);

相关问题