A question/curiosity: When using the time function, why must the argument be 0, as "time(0)"? I tried other numbers and it gave error.
sgw 0 Junior Poster in Training
Recommended Answers
Jump to Posttime's parameter is an alternate return path. If you pass in NULL (or 0) it is ignored. Otherwise, you must pass the address of a time_t object which will be filled with the time.
Jump to Post
time(0);
ortime(NULL);
returns the system time in seconds ...The C++ Declaration of the 'time()'-function looks as follows:
time_t time ( time_t * timer );
So if you pass a NULL-pointer as argument, it will just return the time ...
But between the brackets you can also type …
All 7 Replies
Danny_501 2 Junior Poster
nucleon 114 Posting Pro in Training
vmanes commented: Good clear answer! +8
tux4life 2,072 Postaholic
tux4life 2,072 Postaholic
nucleon 114 Posting Pro in Training
sgw 0 Junior Poster in Training
ArkM 1,090 Postaholic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.