Ok, sure.
Error:
Code:
miranda@ubuntu:~/Desktop/proj2$ make -s all
In file included from ADT.c:5:
Item_is_voo.h: In function ‘LISTdeleteel’:
Item_is_voo.h:10: error: storage class specified for parameter ‘Item’
Item_is_voo.h:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
...
I'm resolving the bugs step by step so I think the next errors are not important but feel free to ask if you need more information.
LISTdeleteel is a function that deletes the first element of a basic linked list. I've tested all the functions of the type "voo" and tested all the list functions when Item is int. Now I want to make a list of pointers to the type "voo" and I'm getting that error.
Item_is_voo.h
Code:
/* Item_is_voo.h - Definições para Item = voo */
#if defined __Item__
#undefine __Item__
#endif
#include <stdlib.h>
#include "ADT.h"
typedef voo *Item;
voo *NEW(voo v) {
voo *temp;
temp = (voo *) malloc(sizeof(voo));
return temp;
}
On ADT.c
Code:
#include "ADT.h"
#include "Item_is_voo.h"
#include <stdlib.h>
...
Code:
/* LISTdeleteel
LISTdeleteel(ptrlst) altera a lista apontada por
<ptrlst>, apagando o primeiro elemento. */
void LISTdeleteel(list *ptrhead) {
link temp;
temp = *ptrhead;
*ptrhead = (*ptrhead)->next;
free(temp);
}
ADT.h
Code:
/* ADT.h -- definições e declarações globais
para o ficheiro ADT.c */
#if !defined __tai__
#define __tai__
/* Definições de tipos (as operações básicas
estão definidas no ficheiro ADT.c */
/* Tipo vôo */
struct voo {
char cod[7];
char orig[4];
char dest[4];
int horaspartida;
int minspartida;
int horaschegada;
int minschegada;
float preco;
};
typedef struct voo voo;
/* Tipo lista simplificada */
#include "Item_is_voo.h"
struct node {
Item value;
struct node *next;
};
typedef struct node *link;
typedef struct node *list;
/* Declaração das funções definidas
no ficheiro ADT.c (operações básicas e operações de alto nível) */
voo cria_voo(char*, char*, char*, int, int, int, int, float);
char *cod_voo(voo);
char *orig_voo(voo);
char *dest_voo(voo);
int horaspartida_voo(voo);
int minspartida_voo(voo);
int horaschegada_voo(voo);
int minschegada_voo(voo);
float preco_voo(voo);
void adiavoo(voo*, int, int);
list LISTnew();
void LISTinsert(Item, list*);
Item LISTfirst(list);
list LISTrest(list);
void LISTdeleteel(list*)
int LISTtestifempty(list);
#endif