Possible Duplicate:
Difference between string.h and cstring?
What is better programming practice in C++ when including the standard header files with respect to
including cmath in place of math.h or vice-versa?
including cstring in place of string.h or vice-versa?
and for other <c*> and <*.h> header files which apparently seem to accomplish the same thing?
<cstring>is newer;<string.h>is really there for backwards compatibility (and for C, of course). The difference is that<cstring>puts the string functions in thestdnamespace, while<string.h>puts them in the global namespace.In addition,
<cstring>changes the types of certain functions to promote type-safety. E.g., the C declarationis replaced by the overloads (in the
stdnamespace)In the case of
<cmath>there are further differences with<math.h>which make<cmath>more idiomatic and less C-like.Prefer
<cstring>for new code and use thestd::prefix on the functions.