Appendix C language of some small summary

Mr. unit together today and overtime, but also no less than quiet heart to write a program, you look at some see Appendix C language. We need to remember there are some small summary to share.

1. For binding operators carefully. For ease of memory, using the bit operator, to add parentheses.

2. Conditional Expressions

  Form: logical expression? Expression 1: Expression 2

  If the value of the logical expression is nonzero, then the conditional expression expression value is equal to 1; if a logical expression is 0, the value of the conditional expression 2 is equal to the value of the expression.

3. Storage categories are available

  auto  static  register  extern

4. The variable is defined in the form of

  Data storage class type variable table column;

  static float a,b,c;

  Note that the external data can only be defined as extern or static, rather than using auto or register.

The function is defined in the form of

  Stores category data type function name (parameter list column)

  Function body

6. initialization of variables

  Static variables or external uninitialized variables, so the system automatically initialized to zero (for a numeric variable) or empty (for character data). Automatic variable or register variables, if not initialized, its initial value is not a prediction data.

 

 

Example:

static int max(int x,int y)

{

    int z;

    z=x<y?x:y;

    return (z);

}

Guess you like

Origin www.cnblogs.com/Jane-share/p/11294243.html