+ 1

How to get the first element in an string array c++?

I'm used to work with string array like this: Std::string names[] = { "john", "martinez"}; I don't have any problem to get the name 'jhon', but I don't know hot to obtain 'john' when the array is like this: Std::string names[] = { "john martinez", 'rick Morty"}; When I want to access to the first element, it gets "john Martinez" and not only "John", how can I get only "John" without Martinez?

24th Jan 2019, 11:22 PM
Eduardo Perez Regin
Eduardo Perez Regin - avatar
2 Respuestas
+ 4
Anything between those "quotation marks" becomes the element spaces included.
25th Jan 2019, 12:14 AM
D_Stark
D_Stark - avatar