ctime or time.h? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

ctime or time.h?

I have been taught to use time(0) on srand, is it actually the same or there's a difference? Please clarify

19th Dec 2016, 5:58 PM
Brian Buelot Lopez
Brian Buelot Lopez - avatar
2 Answers
+ 4
You should use time.h in C and ctime in C++
19th Dec 2016, 9:47 PM
Adam Emieljaniuk
Adam Emieljaniuk - avatar
0
time.h will be an error, you need to use ctime
19th Dec 2016, 7:11 PM
Nathan
Nathan - avatar