Dark Horse Programmer---iOS learning log 6

Source: Internet
Author: User

------<a href= "http://www.itheima.com" target= "blank" >java training, Android training, iOS training,. NET training </a>, look forward to communicating with you! -------

scanf function

The SCANF function prototype is included in the standard input and output header file "Stdio.h" for receiving keyboard input content.

The scanf function is a blocking function

Blocking function: After the function executes, it waits for the user to enter, and if the user does not enter anything, he waits

Format: scanf ("Format control string", entry address list);

The address of a variable in the C language can be obtained by the address operator &. For example: Define int A; The address of a is &a.

code example

#include <stdio.h>

int main (int argc, const char*argv[]) {

Enter a person's age from the keyboard and print it out

Define a variable

int age;

Prompt the user for an age

printf ("Please enter a person's age: \ n")

Put the user input value into the age variable

scanf ("%d", &age);

Print the age of user input

printf ("%d", age);

return 0;

}

Dark Horse Programmer---iOS learning log 6

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.