Why this line exceeds 80 characters in width of a GNU / Linux or OSX console:
printf("%16s %16s %16s %16s %16s\n",
"Artículo", "Cantidad", "Precio unitario", "Descuento", "Total");
Thanks in advance.
Best regards
Why this line exceeds 80 characters in width of a GNU / Linux or OSX console:
printf("%16s %16s %16s %16s %16s\n",
"Artículo", "Cantidad", "Precio unitario", "Descuento", "Total");
Thanks in advance.
Best regards
The format specifier of the function
int printf ( const char * format, ... );
has the following scheme:
% [flags] [width] [. precision] [length] specifier
In the example you have the following:
printf("%16s %16s %16s %16s %16s\n",
"Artículo", "Cantidad", "Precio unitario", "Descuento", "Total");
Note that the format specifier you use is % 16s . This will cause you to reserve 16 characters for each additional argument (...) . Then, considering that in the string you have as an argument:
"%16s %16s %16s %16s %16s\n"
5 additional arguments are expected, adding also 4 ( ' '
) spaces that are specified in the string, this gives us the total of > 84 characters.