set head to NULL (‘NULL’ : undeclared identifier)

As written, NULL isn’t defined in your program. Usually, that’s defined in a standard header file — specifically <cstddef> or <stddef.h>. Since you’re restricted to iostream, if yours doesn’t get NULL implicitly from that header, you can use 0 or, in C++11, nullptr, which is a keyword and doesn’t require a header. (It is not recommended to define NULL yourself. It might work sometimes, but it is technically illegal.)

Leave a Comment