The only way this is worse is that the old code never initialized (or used) the value in some code codes.
Another problem is
char data_string[99] = "data data data";
Will initialize 99 characters, not just the first 15. What does this
char data_strings[99] = "";
much more expensive than that
char data_strings[99]; data_strings[0] = 0;
Of course, if the buffer really needs to be large enough to hold βdata data data,β then itβs better
char data_string[] = "data data data";
But this makes you wonder if you ever need to copy a string to the stack variable at all.
source share