Home > Back-end >  printf
printf

Time:09-27

Static int count=0;
Printf (" global op called size % zu sum: % d ", sz, + + count);

Why don't count gagarin,
What is % zu format control????????????

CodePudding user response:

You must be related to the compiler (do not accord with standard of C/C + +)
I test in the compiler, there are two different results (set sz 1234)
One is
Global op called, sizezu sum: 1234
If your sz is 0, the result is
Global op called, sizezu sum: 0
It ignores the % z, the direct output of z, and behind only take the value of sz, so I have nothing to do with the count
While another output for
Global op called, size1234 sum: 1
It is ignored in the % z z, as % u SZR output value, then the value of output + + count
This is actually a problem you program itself

CodePudding user response:

+ + count, the count on the first is equal to 1, the output count to 1
If write count++, first output count is 0, the count again since the increase is equal to 1

CodePudding user response:

Didn't understand your meaning, please ignore on the first floor,

CodePudding user response:

As I understand it, % zu is introduced in C99, for printf format output type size_t data set,