The codes compiles without error, but time
is declared nowhere.
Fortunately, the error has been gone as I changed the name as mtime. But what is the nature of the error is? What is time
?
The output of this program is 1
. I wonder if there is anything called time
in the file iostream
or somewhere.
#include <iostream>
int main()
{
std::cout << time << std::endl;
return 0;
}
It is the address of a time_t time(time_t*)
function as your <iostream>
implementation includes the time.h
header. The address will never be NULL and is implicitly convertible to boolean hence the result of 1
. You are probably using g++ on Linux.