Can someone please explain why "#include <stdlib.h>" fixes "warning: implicit declaration of function". Also what does #include <stdlib.h> mean and when should you use it?

stdlib.h is one of the C standard headers and contains quite a large and varied number of function declarations, the exact contents you can easily google.

If you call a function without having first declared or defined it when it is defined somewhere in your program then in C you will get an "implicit declaration of function" warning because when the compiler sees the function call it implicitly declares the function as returning int.

#include <stdlib.h> fixes this for any functions that it contains the declarations for because if you included it then you have declared those functions so no implicit declaration happens.

You should usw #include <stdlib.h> anytime you want to call a function that it contains the declaration for.

commented: Nice +20