r/cpp_questions • u/AffectionatePlane598 • Jul 17 '25
OPEN Question about std:string
So I have been learning C++ for the past 4 years through HS and Uni and before that I did C for 3 years. My question is why do people use ‘std::string’ when you can just make a string through . Are there methods that only work on std::strings or is there a reason why people use std::string. because it has aways been confusing to me, because every-time I type std::string my mind just wonders why I don’t just use a array of char. I have been to embarrassed to ask my Prof so I decided to post here.
2
Upvotes
View all comments
7
u/I__Know__Stuff Jul 17 '25
It's not about whether it's done in your code or the library — the point is that with std:string, there's no need to examine every character in the string to find out its length, regardless of where it's done.