Start New Discussion within our Software Development Community

along with that error i also get these for that same line
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)

here is that line of my code

class Queue{                                //Number 2
protected: 
    struct Book *front;
    struct Book *rear;
public:
    Queue(void){                            //Default constructor
        front=NULL;
        rear=NULL;
    }
    
    Queue(int n){                            //Constructor that takes an int
        front=NULL;
        rear=NULL;
    }

    void enqueue(char *str, long dueD){
        bookInsertion(str, dueD);
    }
    struct Book* dequeue (void){
        if(front!=NULL){
            return front;
            delete front;//This prevents memory leaks
            front=front->next;
        }
        else{
            cout<<"Error:Queue emtpy"<<endl;
            return NULL;
            }
    }

    void bookInsertion(char *str, long dueD){
    struct Book *node;
    node=(struct Book*)malloc(sizeof(struct Book));
    if(node=NULL){
        cout<<"Could not allocate memory!\n"<<endl;
    }
    strcpy(node->title, str);
    node->&dueDate=dueD;
    if(front==NULL){
        front=node;
        rear=node;
    }
    else{
        rear->next=node;
        rear=rear->next;
    }

    }
}
This question has already been answered. Start a new discussion instead.