do i need to use time as a variable type; is it defined for that type of use?
Code:#include <time.h>
// aditional code
int main(void)
{
time_t // or do i just use time and then say stuff like time now, start, finish
// additional code
}
Printable View
do i need to use time as a variable type; is it defined for that type of use?
Code:#include <time.h>
// aditional code
int main(void)
{
time_t // or do i just use time and then say stuff like time now, start, finish
// additional code
}
time_t is NOT a variable, but it is a typedef for an unsigned int. So what you posted is the same as this
This is incorrect because you did not specify a variable nameCode:int main
{
unsigned int <<<wrong
}
Code:int main
{
time_t today; <<<right
}
>but it is a typedef for an unsigned int
Amazing that you can somehow divine the underlying type when even the standard isn't specific. I'm impressed. :rolleyes:
time is a function. time_t is a type as is clock_t and the struct tm.
http://www.cplusplus.com/ref/ctime/
Also, use #include <ctime>.
If you haven't learned about structures yet, you need to understand them first.
There's some <ctime> information in the cprogramming.com FAQ too.
well ty i read a little more, i am teaching myself and without seeing code, it can be difficult. Anyway i got it i have read about typedef's