C++: assign two values to char** in one line? -
i try assign 2 c-strings @ once:
char **pair = {"name","joe"};
but error message:
'initializing' : cannot convert 'const char [5]' 'char **'
but think worked me before?
joachim approach creates read-only string. that's how create array of const string literals.
another way,
// max_len being max string length. char pair[][max_len] = {"name","joe"}; // makes pair read-writeable,
Comments
Post a Comment