How is my compiler able to use the srand function without #include <cstdlib>? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How is my compiler able to use the srand function without #include <cstdlib>?

I am using VS 2017. How is my compiler able to use the srand function without #include <cstdlib>?

15th Aug 2018, 4:00 PM
Alokananda Y
Alokananda Y - avatar
2 Answers
0
Doesn't VS create a stdafx.h header that includes stdlib.h?
15th Aug 2018, 7:51 PM
Vlad Serbu
Vlad Serbu - avatar
0
iirc if you attempt to use a function without including the header it's from VS will include said header for you, this slows compile-time by an insignificant amount of time, but it's still good practice to include the proper headers
15th Aug 2018, 10:25 PM
hinanawi
hinanawi - avatar