I know, that C allow I do it.
char *array[] = {"String1", "String2",...};
but I wanna do it.
char **array or char *array[3];
array = {"String1", "String2"...};
Because I think that using a loop to fullfill a array is very bad instead initializing like a showed.
Thanks.
Short answer: no, you can’t.
When initialising a non-static array like this, the compiler has to generate code to copy the initial state of the array out of storage and into the new array. (Because it’s a new array every time you call the function.) It’s not actually much slower to write code to do this yourself.
Long answer: if you’re willing to be evil, you can sort of do it, in C99, by wrapping the array in a struct and using structure assignment…
(syntax may not be quite right.)
But that’s evil, and only works in C99, so don’t do it, mmm’kay?