C Escape character

Source: Internet
Author: User

C Language Output special characters

The C language escape character is roughly the same as the preceding C # escape character, which lists the methods of C, output%d, \ n, and so on.

#include <stdio.h>intMain () {printf ("%%d");//output%d in the screenprintf ("\\n");//output in the screen \ nprintf ("%d");//0printf ("%%%%%d");//%%0printf ("%%%%d");//%%d    return 0;}

About%f and%LF

%f and%lf are the float type and the double type are used to format the input and output corresponding to the format symbol.
which
Float, single-precision floating point, corresponds to%f.
Double, dual-precision floating point, corresponding to%LF.

The following program calculates and outputs a value of 500/3, leaving 3 decimal places in the result

#include <stdio.h>int  main () {    printf ("%.3lf\n",500.0 /3.0);    // format symbol%.3LF means three decimal    places reserved return 0 ;}

C Escape character

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.