$5 Operators and expressions && $6 Data input/output functions

$5 operators and expressions

(1) Automatic type conversion and forced type conversion

Insert picture description here

(Ii) Arithmetic expression

  • '*', /,% have higher priority than +,-

  • Insert picture description here

  • When the precedence of arithmetic operators is the same, the associative direction is "from left to right"

(Iii) Increment and decrement operator

Insert picture description here
Insert picture description here
Insert picture description here

(Iv) Relational operators and expressions

Insert picture description here
The relational operators <, <=, >, >= have the same precedence, == and! = Has the same precedence, and the precedence of the first four operators is higher than that of the latter two, and the associativity is from left to right.
Insert picture description here

(V) Logical operators and expressions

Insert picture description hereInsert picture description here
Insert picture description here
Insert picture description here

(Vi) Comma operator

Insert picture description here
Insert picture description here

Operator precedence and associativity

Insert picture description here

$6 Data input/output function

(I) Statement

  • Expression statements
    Insert picture description here
    such as:
    Insert picture description here

  • Function call statement
    Insert picture description here
    such as:
    Insert picture description here

  • Empty sentence A sentence
    consisting of only ";".
    Insert picture description here
    Insert picture description here

  • Control statement
    Insert picture description here

  • Compound sentence

(Ii) Input/output

input Output:

  • Character input/output functions getchar() and putchar()

  • Format input/output functions scanf() and printf()
    - printf()Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    - scanf()
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here

  • String input / output functions
    - the puts () (determined in the character '\ 0' terminator, terminator is encountered, is no longer behind the characters and outputs wrap)
    - the gets ()
    Insert picture description here

Sequence programming application

Sequential program structure: execute in order of program order; execute in sequence according to the order of statements, without jumps and loops.

Reference books:
Introduction to C language development and actual project combat

Guess you like

Origin blog.csdn.net/qq_41070511/article/details/110677069