String array and Arraylist/list in C++
I am new to C++, can anybody provide m开发者_JAVA百科e some sample program's for String array and Arraylist/list in C++
Thanks in Advance.
You can use std::vector<std::string>
. it can be accessed like a normal array (i.e. it provides operator[]
). See here for the methods provided by vector. You can insert the elements using push_back and access elements either using an iterator
or operator[]
[3]: [3]: http://www.cplusplus.com/reference/stl/vector/operator%5B%5D/
[3]: [3]: http://www.cplusplus.com/reference/stl/vector/operator%5B%5D/
You can refer the following urls,
1. String
2. Character Sequence
3. STL
精彩评论