You can do:
const char* yo2 = (char [4]) { 'a', 'b', 'c', '\0' };
which is valid and will achieve what you want. Note that this is not equivalent:
const char* yo2 = "abc":
In the first case, when yo2declared in a file area: an array of compound literals has a static storage duration, but when yo2declared in a block area, a composite literal has an automatic storage duration.
"abc" ( ).
:
const char yo2[] = { 'a', 'b', 'c', '\0' };
. C:
const char* yo2 = { 'a', 'b', 'c', '\0' };
, :
const char* yo2 = (char *) 'a';
'a' (), yo2 undefined.