Yes. I did. Hey, you did not reply my last question from the last post in the present block. I am trying to understand, how does it click on your head if a people share same post in two different block, just to achieve a better answer. Can you reply it?.
Don't worry about #including stdlib.h multiple times. It has its own header guards.
Also, don't define non-inline or non-template functions inside a header file. If you end up with multiple compilation units (.cpp files) that include that header file, you'll get multiple definitions of the function. Instead, declare the function in the header and define it in a cpp file
> How can I prevent the duplication of stdlib.h in main.cpp?
The C standard guarantees that including a standard header multiple times has the same effect as including it just once.
Standard headers may be included in any order; each may be included more than once in a given scope, with no effect different from being included only once, except that the effect of including <assert.h> depends on the definition of NDEBUG
This guarantee holds, even though the header need not be an actual file:
A header is not necessarily a source file, nor are the < and > delimited sequences in header names necessarily valid source file names.