Can someone please help me understand why pPre->head = NULL is giving me an error. Also why is pLoc = list->head not allowed?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
struct node{
int data;
node *backward;
node *forward;
};
struct list{
int count;
node *head;
node *rear;
};
bool SearchList(int target)
{
bool found;
list *pPre = new list;
list *pLoc = new list;
pPre->head = NULL;
pLoc = list->head;
}
|
Last edited on
why pPre->head = NULL is giving me an error
what error did you get?
why is pLoc = list->head not allowed?
because list
is a type not an object , you would need to use an object of type list
to accomplish what you want.
Last edited on
It says identifier NULL is undefined.
> It says identifier NULL is undefined.
#include <cstddef>. Or better: pPre->head = nullptr ;
I just included all those headers and it still gives me the same error. And it says cannot open source file for all the headers I included