An error occurs when the scanf function is output in the C language and \ n is added to the line conversion symbol.

Source: Internet
Author: User

Compile C LanguageCodeI believe everyone is familiar with using the transpose line \ n. I have never tried to add the transpose line \ n in the input function scanf, I added a try today, for example, entering the values of A and B, as shown below:

Scanf ("% d, % d \ n", & A, & B) printf ("A =, B = \ n", a, B );

The output of a value is correct during runtime, but the value of B is always wrong. I checked the book and it turns out that adding the line symbol in scanf does not work, because the input function scanf does not provide the transpose function, an error will often occur after the transpose symbol \ n is added. If the transposed symbol \ n in scanf is removed, the output will be correct.

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.