Is the only way to stores strings as a variable in C++ is by having an array of type char?

Recommended Answers

All 2 Replies

Nope, you can store strings however you want. I've seen people use linked lists before, for example. And to support broader character sets, you're not restricted to the char type either. However, the de facto standard string is an array of char/wchar_t or an object of basic_string<char>/basic_string<wchar_t>.

Nope, you can store strings however you want. I've seen people use linked lists before, for example. And to support broader character sets, you're not restricted to the char type either. However, the de facto standard string is an array of char/wchar_t or an object of basic_string<char>/basic_string<wchar_t>.

Thanks for that mate, appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.