Format a string

Source: Internet
Author: User
% U indicates that the value range of the unsigned decimal output integer is 0-65535, that is, the corresponding binary number 0-1111111111111111 (16 1 ).

% LD indicates output in decimal long integer type

% X, % x unsigned integer in hexadecimal format



% U, used to format a string. The utable shows that the string is formatted as an unsigned integer (unsigned INT)










For example: int I = 1, j =-1;

The signed integer-1 is expressed as 0 xfffe in hexadecimal notation.

The result of printf ("I = % u, j = % u", I, j) is

1, 4294967295 (0xfffe is directly converted to decimal)




% D signed 10-digit integer

% I signed 10-digit integer
% O unsigned octal integer
% U unsigned 10-digit integer
% X unsigned hexadecimal number, expressed in lowercase abcdef
% X unsigned hexadecimal number, expressed in abcdef
% F/F floating point number
% E/E floating point in scientific format
% G indicates the minimum number of digits in % F and % E to indicate the floating point G in the same g format, but expressed as an index.
% C single character
% S string

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.