gpt4 book ai didi

c - 应为 ‘struct CELLULE **’,但参数的类型为 ‘struct CELLULE’

转载 作者:行者123 更新时间:2023-11-30 15:01:06 26 4
gpt4 key购买 nike

大家好,希望你们一切都好,

我来这里是为了搜索一些帮助,因为我有一个小问题,当我尝试编译我的程序时,我在这一行的函数 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 原型(prototype)是

identifiant 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:抱歉我的英语不好,我希望你能理解,感谢所有帮助我的人(^_^)

最佳答案

尝试使用 d = DEPILER(&p); 而不是 d = DEPILER(*p);

关于c - 应为 ‘struct CELLULE **’,但参数的类型为 ‘struct CELLULE’,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41656578/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com