I am writing a Queue class implementation, and my Queue holds a object called Flight. I tried to create this object by struct. Some part of my code is here:
#include <stdio.h>
#include <stdlib.h>
typedef struct {
int C_TIME;
int D_TIME;
char FL_NUM;
char D_CITY;
}Flight;
#define MAXSIZE 5
typedef Flight ItemType;
typedef int PosType;
typedef struct{
ItemType Data[MAXSIZE];
PosType Rear,Front;
}QType;
QType Q;
void CreateQ(void);
int EmptyQ(void);
int FullQ(PosType NewR);
void AddQ(ItemType Item);
void RemoveQ(ItemType*);
void CreateQ(void)
{
int i;
Q.Front=0;
Q.Rear=0;
for (i=0;i<MAXSIZE-1;i++){
Q.Data[i]=NULL; // Here it does not allow Q.Data[i].C_TIME.
}
}
In the main program I can create object by using "Flight" struct, but in the Queue class it does not allow : Q.Data.D_DATE or Q.Data.C_DATE
Any idea?