Liste des Groupes | Revenir à cl c |
On 13.06.2024 00:22, Keith Thompson wrote:That depends on your toolchain.>Oops! This surprised me. (But you are right.) The overhead isn't
This:
char outliers[100] = "";
initializes all 100 elements to zero. So does this:
char outliers[100] = { '\0' };
Any elements or members not specified in an initializer are set to zero.
[syntactically] obvious, but I'm anyway always setting a single
'\0' character if I want to store strings in a 'char[]' and have
it initialized to an empty string (like below).
If you want to set an array's 0th element to 0 and not waste timeIt wouldn't occur to me to use the strcpy() function, but is the
initializing the rest, you can assign it separately:
char outliers[100];
outliers[0] = '\0';
or
char outliers[100];
strcpy(outliers, "");
though the overhead of the function call is likely to outweigh the
cost of initializing the array.
function call really that expensive in C ?
Les messages affichés proviennent d'usenet.