iOS Basic Learning Day 3rd

Source: Internet
Author: User

Memory addressing from large to small, priority allocation of memory address larger bytes to the variable; the more defined the variable, the greater the memory address; Gets the address of the variable:& variable name; output address:%p; A variable must be advanced to initialize before it can be used.

The SCANF function accepts only the address of the variable, and the scanf function is a blocking function that waits for the user to enter, and then assigns the user input value to the corresponding variable.

Enter multiple values at once and separate them with some symbols, using the same symbol to separate them, and if the scanf parameter is separated by a space, the actual input can be separated by a space, tab, and carriage return. The scanf cannot write \ n.

Take the remainder operation (modulo operation):% is an integer on both sides, the positive and negative of the residual result is only related to the value left of%.

 //  automatic type conversion (double->int)  int  a = 10.8  < span> //  automatic type promotion (int->double)  double  C = 10.6  + 6  ;  //  coercion type conversion (Double->int)  int  B = (int ) 10.5 ; 
    // Compound assignment operator    5 // A = a + 5;    5 6 4//A = a + (5 + 6 + 4);         

The value of a++ is the value of a before the increment of a, and the value of ++a is the value of a since the increment of a, a--,--a the same.

    // int size = sizeof (ten);     // int size = sizeof 10.9;        int Ten ;         // int size = sizeof (a);     // int size = sizeof A;        int sizeof (char);     //  //  the wrong

In the relational operation, the condition is set to return 1, true; returns 0, False if the condition is not established.

Logic and Conditions 1 && conditions 2

Logic or Condition 1 | | Condition 2

Logical NOT! Condition: Returns 0 if the condition is true, and returns 1 if the condition is not true.

The three-mesh operator condition? Value 1: Value 2

When comparing the size, the constant value is left and the variable is placed to the right.

Note the assignment operator, and do not write the two equals sign.

Do not write a semicolon after the IF statement.

    // The following code is wrong: The scope is    ambiguous if (6)         int 5 ;     // if you want to define a new variable in the statement after the IF, you must use the curly braces {}

Break: Exits the entire switch statement and, if there is no break after the case, executes the statements in all subsequent sentences until a break is encountered.

If you want to define a new variable after the case, you must enclose it in curly braces {}.

If and switch:

1. If statement can complete the function, switch does not necessarily be able to complete.

2. In some cases, the IF statement and the switch statement are interchangeable.

3. Switch can complete the function, if statement can be completed.

iOS Basic Learning Day 3rd

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.