Some differences in C integer format control characters

This switched https://blog.csdn.net/gx17864373822/article/details/78333338, thanks to the original bloggers share.

C language differences% d% .2d% 2d% 02d of


% D: is the normal output.

Here Insert Picture Description

% 2d: 2 is output by the width, alignment to the right output. If two is not enough, left the meeting spaces.

Here Insert Picture Description

% 02d: 2 of the same width, alignment to the right. The median is not enough left 0s.

Here Insert Picture Description

% .2d: from the implementation point of view, with the same% 02d.

Here Insert Picture Description

Guess you like

Origin blog.csdn.net/weixin_40688217/article/details/90083119