"Good Programmer's note sharing" other uses and attention of the scanf function of C language

Source: Internet
Author: User

#include <stdio.h>intMain () {/*1. Enter character Char Myc;    scanf ("%c", &MYC);     printf ("The character entered is%c\n", MYC); */    /*2. Enter multiple values at once and separate int num1 with some symbols, num2;    scanf ("%d#%d", &num1, &num2);    printf ("num1=%d, num2=%d\n", NUM1, num2); */    /*3. If the scanf parameter is separated by a space, the actual input can be a space, tab, carriage return as the delimiter int num1, num2;    scanf ("%d%d", &NUM1, &num2);    printf ("num1=%d, num2=%d\n", NUM1, num2); Space: Ten num1=10, num2=10 logout Tab key: Ten num1=10, num2=10 logout Enter: Ten n um1=10, num2=10 logout*/    /*cannot write \ n int a in 4.scanf; scanf ("%d\n", &a);     The wrong wording printf ("A's value is%d\n", a); */    return 0;}

"Good Programmer's note sharing" other uses and attention of the scanf function of C language

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.