J
jacob navia
Hi
I am writing this tutorial stuff again in the holidays and I came across
this problem:
The "width" field in printf is a minimum width. Printf will not truncate
a field. for instance:
#include <stdio.h>
int main(void)
{
printf("%5s %03d\n","1234567890",12345);
}
will print
1234567890 12345
and NOT
12345 123
as expected.
-------------------
OK, but how can I EXPLAIN this stuff? Is there any reason?
And no, "compatibility with previous bugs" is NOT an explanation
at least for me, and not for a beginner.
What could I say here?
Thanks
I am writing this tutorial stuff again in the holidays and I came across
this problem:
The "width" field in printf is a minimum width. Printf will not truncate
a field. for instance:
#include <stdio.h>
int main(void)
{
printf("%5s %03d\n","1234567890",12345);
}
will print
1234567890 12345
and NOT
12345 123
as expected.
-------------------
OK, but how can I EXPLAIN this stuff? Is there any reason?
And no, "compatibility with previous bugs" is NOT an explanation
at least for me, and not for a beginner.
What could I say here?
Thanks