The first one is a C++ header and the second is a C header. Since the first uses a namespace, that would seem to be preferable. Show activity on this post. No, other than the namespace situation, they're essentially identical.
h is the header of the general purpose standard library of C programming language which includes functions involving memory allocation, process control, conversions and others.
The C++ Standard Library header file (cstdlib in C++) is the header for one of the most widely used libraries by programmers of the language. This header defines a collection of functions and macros to facilitate efficient, high-performing, standardized C++ code across teams and platforms.
Of course you need to include <stdio. h> only in translation units using some standard I/O function (or name of a type like FILE , or variable like stdout ). So you can avoid <stdio. h> in modules unrelated to I/O, such as code doing only computations.
I'm using EXIT_FAILURE macro, so I need to include stdlib.h or cstdlib. But I don't know what the difference is. Should I use cXXX style header file rather than XXX.h?
Thank you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With