私が指摘した21行目と22行目でこのエラーが発生しています。同様のエラーメッセージが表示される他のケースから判断すると、どこかに構文エラーがあります。何がわからないのかわかりません。.cppファイルは次のとおりです。
#include <iostream>
#include <cstdlib>
#include "deque.h"
using namespace std;
struct node{
int data;
node *prev;
node *next;
};
Deque::Deque(){
count = 0;
node->head->next = node->head; //error on this line
node->head->prev = node->head; //and this one
}
これが私のヘッダーファイルです:
# ifndef DEQUE_H
# define DEQUE_H
class Deque
{
private:
int count;
class node *head;
public:
Deque();
~Deque();
int size();
void addFirst(int);
void addLast(int);
int removeFirst();
int removeLast();
int getFirst();
int getLast();
};
#endif