Я новичок в модульное программирование, и я надеюсь, что вы можете помочь мне :) Так вот мой .c .h: item.hОшибка: Неизвестный типа имя
#define L 31
#define L1 11
typedef struct{
int priority;
char service_type[L];
char client_code[L1];
}*Item;
Item New_client();
item.c
#include <stdio.h>
#include <stdlib.h>
#include "item.h"
Item New_client(){
Item new_c=malloc(sizeof new_c);
printf("Inserire priorita': "); scanf("%d",&new_c->priority);
printf("Inserire servizio: "); scanf("%s",new_c->service_type);
printf("Inserire codice cliente: "); scanf("%s",new_c->client_code);
return new_c;
}
PQ.h
typedef struct Nodo *link;
struct Nodo{
Item item;
link next;
};
void init(link coda);
int empty_(link coda);
link insert_(link h,Item client);
PQ.c
#include <stdio.h>
#include <stdlib.h>
#include "PQ.h"
Так как я включаю PQ.h в PQ.c, я получаю сообщение об ошибке: неизвестное имя типа «Item» из CodeBlocks ... Я не могу понять, почему и что я могу сделать для решения проблемы.
Обратите внимание, что 'malloc (sizeof new_c)' должно быть 'malloc (sizeof * new_c)'. –
Да, ты прав. – Andrea