2018-10-18 22:15:32 C language

Source: Internet
Author: User
Tags print format

2018-10-18 22:15:32 C language

Output various types of data on the screen
    1. We use puts to output strings. Puts is an abbreviation for output string, can only be used for outputting strings, cannot output integers, decimals, characters, etc., we need to use another function, that is printf. printf is the abbreviation for print format, meaning "format printing".
    2. %c: Outputs one character. c is shorthand for character. %s: Output a string. S is shorthand for string. %f: Outputs a decimal. F is a shorthand for float.
    3. \nis a whole, grouped together to represent a newline character. Line break is a control character in ASCII encoding, cannot be entered directly on the keyboard, can only be represented by this special method, known as the escape character, we will be in the "C Language escape character" section of the specific explanation, please let us briefly remember \n the meaning.
    4. The difference between puts and printf when outputting a string: The puts output is wrapped, and printf does not have to add the line break itself.
    5. Money's output value is not 93.96, but a very close value, which is related to the storage mechanism of the decimal itself, which causes many decimals to not be accurately represented.
    6. We can also output the data directly without the use of variables.
    7. What does the%ds output? From the output can be found, %d is replaced by the value of the variable a, without s changing, as is output. This is because the %d format control, together with %ds no meaning, s is simply followed %d by a normal character, so it will be output as is.

    8. How to write long text in a string: You can divide long text into several strings in the output statement.

2018-10-18 22:15:32 C language

Related Article

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.