#include <iostream>
#include <ctime>
usingnamespace std;
void getSeconds(unsignedlong *par);
int main ()
{
unsignedlong sec;
getSeconds( &sec );
// print the actual value
cout << "Number of seconds :" << sec << endl;
return 0;
}
void getSeconds(unsignedlong *par)
{
// get the current number of seconds
*par = time( NULL );
return;
}
However, without the piece of code: " getSeconds(&sec);" it produces a constant:
Number of seconds: 4285854
The latter result is obviously not the address, but I also don't know what it is, and why this constant appears when the mentioned piece of code is deleted.
If you don't use that, than your unsignedlong sec; variable doesn't have a value. You declared it, but you didn't give it some value. In this case, you get some strange values, which comes from memory.
(Try it out, with other variables: declare it and than write out without giving it a value.)