Jeust
Power Member
Bem malta ando a fazer uma aplicação involvendo listas ligadas e ao compilar apareceu-me este erro críptico...
bonus.h:9: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
o ficheiro bonus.h é este
sendo o header file deste ficheiro - bonus.c
e o maindef.h está assim escrito
A que se deverá o erro???
abraços
bonus.h:9: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
o ficheiro bonus.h é este
Código:
#ifndef BONUS_H
#define BONUS_H
#include "maindef.h"
#include <stdlib.h>
typedef struct node
{
int id, resneed[Max_Res]={0}, min_tech=0, min_litr=0;
struct node *next=NULL;
} BNode, *Ptr_BNode;
Ptr_BNode head = NULL;
Ptr_BNode last = NULL;
void initNode(Ptr_BNode p, int id);
void addNode(Ptr_BNode p, Ptr_BNode last);
void correction(Ptr_BNode p, int t, int l);
#endif
Código:
#include "bonus.h"
void initNode(Ptr_BNode p, int id);
void addNode(Ptr_BNode p, Ptr_BNode last);
void correction(Ptr_BNode p, int t, int l);
void initNode(Ptr_BNode p, int id)
{
p->id = id;
}
void addNode(Ptr_BNode p, Ptr_BNode last)
{
if(last != NULL)
last->next=p;
}
void correction (Ptr_BNode p, int t, int l)
{
p->min_tech = t;
p->min_litr = l;
}
Código:
#ifndef MAIN_H
#define MAIN_H
#include<stdio.h>
#define Max_Res 21
#endif
abraços
Última edição: