[Results Data] C language instructions assembled base

 

The core data structure C language set of operations 

( 1 ) and the type of predefined constants
 // function result status code 
#define TRUE 1
 #define FALSE 0
 #define the OK 1
 #define ERROR 0
 #define INFEASIBLE -1
 #define the OVERFLOW -2
 // the Status is a type of the function, which is a function of the result status code 
typedef int the status; 


( 2 .) data structures represents (storage structure) described a type definition (typedef) 
the data element type convention is elemType, in use the data type by the user when own definition. 

( 3 algorithm) basic operations are described by the following function of the form: 
    function type function name (parameter list function) { 
        // the algorithm described 
        sequence of statements; 
    } // function name 

    void 

In addition to functions required by the parameters stated type, auxiliary variables used in the algorithm described may not be variable. Note given its role if necessary. 
Generally, a, b, c, d , e , etc. as a data element name, 
I, j, k, l, m, n as integer variables and other names, p, q, r as a pointer variable name. 
when the function returns the result status code value is a function, the function is defined as status type. for convenience of description algorithm, in addition to the value of invocation, 
add C . ++ language called parameter passing reference in parameter list to & parameter is the beginning of the reference parameters 


( 4 ) assignment 
    simple assignment variable name = expression; 
    series assignment a variable name = variable name 2 = ... = k = variable name expressions; 
    group assignment (variable name 1, .., variable names, K) = (expression 1, .., K expression); 
            structure name = name of the structure; 
            structure name = (value 1, ..., K value); 
            variable name [] = expression: 
            variable name [subscript starting at termination .. index] = <-> variable name [subscript start .. termination index];
    Exchange assignment variable name variable name; 
    conditional assignment variable name = conditional expression? Expression T: Expressions F; 


( 5 ) Select statements have 
    conditional statement 1: IF (expression) statement; 
    conditional statement 2: IF (expression) statement;
               the else statement; 
    a switch statement 1: switch (expression) {
                 Case value of 1: the sequence of statements 1: BREAK ;
                 Case value 2: the sequence of statements 2: BREAK ; 
                ... 
                Case value n: the sequence of statements n-; BREAK ;
                 default : sequence of statements + n- . 1 ; 
            } 
    
    switch statement 2: switch{
                case Condition 1: a sequence of statements 1; BREAK ; 
                ... 
                case conditions n: a sequence of statements n-; BREAK ;
                 default : the sequence of statements + n- 1 ; 
            } 



( . 6 ) has a loop: 
    for statement 
        for (expression sequence initial value; Condition ; modified sequence expression) 
            statement; 

    the while statement is
         the while (condition) statement; 

    do - the while statement
         do { 
            statement sequence; 
        } the while (condition); 


( 7 ) has end statement: 
    function end statement return expression;
    end statement case BREAK ; 
    abnormal end statement exit (abnormal code); 


( 8 ) input and output statement 
    input statement: scanf ([format string], variable 1, ..., variable n-); 
             CIN >> ; 
    output statement: printf ([format string], expression 1, ..., expression n-); 
             COUT << ; 
    normally omitted format string 

( 9 ) comment statement 
    -line comment 
        statement // character sequence 
    multiple-line comment
         / * 
        statement 1; 
        statement 2; 
            * / 

( 10 ) substantially has the following functions: 
selecting the maximum value max (expression 1, ..., n-expression); 
for the minimum min (expression 1, ..., n-expression); 
absolute value abs (expression);  
seeking an integer value less than floor (expression);
progressive bit integer values ceil (expression); 
determining the end of a file eof (file variable) or eof
End Analyzing row eoln (file variable) or eoln 


( . 11 ) determines convention logic 
AND operation &&: A && for B, when the A value is 0, no evaluation of B 
or operation ||: For A || B, when when the value of non-0 a, B no longer evaluated

 

Guess you like

Origin www.cnblogs.com/lx17746071609/p/11728118.html