Can we use vector or vector instead of string class always?
Use of vectors instead of strings/char arrays
hi,
the scenario u are talking about is like using array of integer instead of int
string class is used when a single instance of string is required
and vector means that a resizable array of string type is used to store values
vector means resizable array of char type
so the use case differs and you are talking is somewhat not correct.
Can you tell exactly the pros/cons of using
vector instead of string class?
bro, they are used in different scenarios
vector is used when multiple string need to be stored
A string is an array of characters that ends with a null character \0.
please read about vector stl
and string, u are confusing urself with some basic concepts
Actually I was looking for this answer.
I guess the confusion happened because I observed now that in previous messages “char” wasn’t shown in vector .
are u clear now with the doubt?
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.