Is it possible to initialise a character array with a conditionally selected string literal?
- 阅读更多 关于 Is it possible to initialise a character array with a conditionally selected string literal?
I know it's perfectly possible to initialise a char array with a string literal: char arr[] = "foo"; C++11 8.5.2/1 says so: A char array (whether plain char , signed char , or unsigned char ), char16_t array, char32_t array, or wchar_t array can be initialized by a narrow character literal, char16_t string literal, char32_t string literal, or wide string literal, respectively, or by an appropriately-typed string literal enclosed in braces. Successive characters of the value of the string literal initialize the elements of the array. ... However, can you do the same with two string literals in