Irmantas Ivanauskas
Irmantas Ivanauskas

Reputation: 1

conflicting types in priority queue C

structure:

typedef int TIPAS;

struct sarasas{
    int prioritetas;
    TIPAS kintamasis;
    struct sarasas *kitas;
};
typedef struct sarasas elementas;

struct priorEile{
    elementas* galva;
    int ilgis;
};
typedef struct priorEile* p_eile;
typedef struct priorEile** p_eile2;

header:

void sukurti(p_eile2); 

function

void sukurti(p_eile* eilute){
    *eilute=(struct priorEile*)calloc(1,sizeof(struct priorEile));
    (*eilute)->galva=NULL;
}

it's all about creating priority queue. I have an error conflicting typer in "sukurti" and previous declaration of "sukurti" was there. Any solutions? Where I made a mistake?

Upvotes: 0

Views: 159

Answers (1)

MikeCAT
MikeCAT

Reputation: 75062

You have the error because the type of return value of function sukurti differs between the declaration and the definition.

Try changing int sukurti(p_eile* eilute){ to void sukurti(p_eile* eilute){.

Upvotes: 1

Related Questions