On string doubts

sometime you use cin.getline and sometime getline(cin,array name) please also tell what is difference between char a[10][10] and string [10] and sometime ur header file is cstring and sometime only string i am very confused about stringsss

@lovish2552 hey,The getline(cin,name) expects name to be a string. The second one expects name to be a pointer into a char array, into which it will store a C string.
In almost every situation, only (getline(cin, name):wink: makes sense. Even if you need a C string, it can be accessed afterwards by calling name.c_str().
Also string[10] means you are taking array of strings with 10 elements ,in which each element is of string type,char a[10][10] refers to 2d array with char datatype means every element in 2d array is char type.
The cstring header provides functions for dealing with C-style strings — null-terminated arrays of characters. This includes functions like strlen and strcpy . It’s the C++ version of the classic string.h header from C.
The string header provides the std::string class and related functions and operators.

Thanks a lot
So much

@lovish2552 no problem bro

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.