c language study notes - Operators

The following are the video to see Hao Bin teachers and curricula, review, copy and paste from notes.

Some operators trivial knowledge:

1. incremented or decremented {}

  Increment before ----- ++ i: Category

     After the increment ----- i ++

  Pre-increment and post-increment similarities and differences:

  The same: so that eventually the value of i is increased by one

  different:

    Increment value before the whole expression is the value of i after adding a

    Since increasing the overall value of the expression is the value of i before adding a

Why is there increment?

  Code more refined

  Increment faster

Learn a few questions to understand the increment

  And increment after increment of difference 1. Before we try to block out programming

  2. The increment expression is best not as part of a larger expression to use

   Or to use i ++ or ++ i alone as a statement, not to him as part of a complete compound statement

2. The ternary operator

  A?B;C

  Equivalent to

  if(A)

    B;

  else

    C;

3. comma expression

  format

  (A,B,C,D)

  Features:

    Left to right

    The final value of the expression is the value of the last item

4. Bitwise Operators

  & - Bitwise AND

  && - logic and also called and

  & && completely different meaning and

  

  | - Bitwise or

  || - logical or

  

  ~ - Bitwise

  ~ I i is the variable bit inversion of all

 

  ^ - bitwise exclusive or

  The same as zero, to a different

  

  << - Bitwise Left Shift

    Left by n bits multiplied by 2 ^ n, is faster than performing multiplication

  >> - Bitwise Right Shift

    Left by n bits is divided by 2 ^ n, provided that the data can not be lost, according to positive or negative or zero padding in front of a digital

 Significance bit operator

  By bitwise operations on the data we can accurately to every

Guess you like

Origin www.cnblogs.com/renren-study-notes/p/11564441.html