error: ‘NULL’ was not declared in this scope

This error occurs at compile time:
error: ‘NULL’ was not declared in this scope

Solutions:
Add the following code at the beginning of the file: #include < stddef.h>

or

#include < stdlib.h>

or

#include < cstdlib>

Read More: