it complains about ordered comparison between integer and pointer
"Ordered comparison" means comparison with > or < or >= or <=. It makes no sense to compare a pointer with a null pointer constant this way.
so I change the 0 in the comparison to nullptr
This doesn't make the comparison any more meaningful. It makes no sense to compare a pointer with a null pointer constant this way either.
But then I receive an error message that "'nullptr' was not declared in this scope".
This cannot happen with gcc 7.5 unless you
- compile C rather than C++ or
- pass
-std=c++98 or -std=c++03 somewhere or
- have a broken installation of gcc.
In any case you probably want to fix the comparison (perhaps change > or < to !=) and only then think of maybe replacing 0 with nullptr.