I am having a problem accessing a struct, here is the code
typedef struct QueueStruct {
int Count; /* number of queue items */
void* Front; /* location of item to remove next */
void* Rear; /* place to insert next item */
}*QueueADT;
QueueADT QueueNew()
{
QueueADT *Q;
Q = new QueueADT ;
//t = **Q;
//(*Q)->Count = 0; /* Count == number of items in the queue */
//(*Q)->Front = NULL; /* Front == location of item to remove next */
//(*Q)->Rear = NULL; /* Rear == place to insert next item */
return *Q;
}
int main() {
using namespace std;
QueueADT q;
q = QueueNew();
q->Count = 0;
return 0;
Whenever I try and access and of the member variables I get an access denied message, it looks like I have the pointers setup incorrectly but I can't figure out what I doing wrong. Any help would be appreciated
typedef struct QueueStruct {
int Count; /* number of queue items */
void* Front; /* location of item to remove next */
void* Rear; /* place to insert next item */
}*QueueADT;
QueueADT QueueNew()
{
QueueADT *Q;
Q = new QueueADT ;
//t = **Q;
//(*Q)->Count = 0; /* Count == number of items in the queue */
//(*Q)->Front = NULL; /* Front == location of item to remove next */
//(*Q)->Rear = NULL; /* Rear == place to insert next item */
return *Q;
}
int main() {
using namespace std;
QueueADT q;
q = QueueNew();
q->Count = 0;
return 0;
Whenever I try and access and of the member variables I get an access denied message, it looks like I have the pointers setup incorrectly but I can't figure out what I doing wrong. Any help would be appreciated