sometimes we #include other times we do #include
whats the difference?
Cstring vs string
@pallavivarshney267 The C programming language does not really include a character string data type. Instead, C programmers store strings in arrays of characters, with the convention that a character of value 0 is used to indicate the end of the string. The headerfile string.h
is used in C programs to get access to a variety of functions for manipulating these arrays of characters. The headerfile cstring
is used in C++ programs to get access to these same functions (following the usual convention of C++ standard header names).
C++ does have a character string type as part of its standard. The type is named string
and is declared in the header file string
So in conclusion, #include < string> is used for string
dataype and
#include < cstring> is used for character arrays
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.