Basic outline of C language----1

Source: Internet
Author: User

1. Constant: The amount of value not changed is called constant;

Constant {character type constant {normal character, escape character}, shaping constant, real constant, string constant};

Escape character: \a (warning), \b (backspace), \f (page break), \ n (line break), \ r (carriage return), \ t (horizontal tab), \v (vertical tab);

2. Floating-point data: is a real number that is used to represent a decimal point

Float Type bytes: 4 Valid digits: 6

Number of double bytes: 8 Valid digits: 15

Type of short bytes: 2

CHAR-byte number: 1

int type byte number 2/4

3. Sub-increment operation

++i,--I (adding or subtraction operations prior to operation);

i++,i--(operations are performed after the operation);

The difference between the 4.while and Do....while statements (while the advanced judgment of the while statement is in operation, the Do....while statement is performed first in the operation);

5. "%-m.nf" floating-point data left-aligned digits reserved m-bit decimal digits reserved n bits;

"%+M.NF" floating point data data output right-aligned digits reserved m-bit decimal digits reserved n bits;

%d integer output%s string output%f single-precision output

%o octal form output% long character form output%e exponential output%x hexadecimal unsigned output%ul unsigned long shaping output

6. The relationship between operators (! Non) "Arithmetic operation" relational operation "logical operation" copy operation)

7. (1) if (judgment condition) statement 1

Else Statement 2;

Note: expression 1 is true, 2 is true, only statement 1 is executed, statement 2 is not executed

if (1<4>3) L is similar to this expression, the result of the 1<4 (0 or 1) is evaluated before the result (0 or 1) is compared with 3

The general correct notation is if (1<x&&x<5) only 1<x and x<5 are established when you go back to execute if (1>x| | X<5) As long as there is a 1>x or x<5 in the statement will be executed

(2) if (Judgment statement) Statement 1

else if (judging condition) Statement 2

         ·····················

else statement N;

(3) Swich (expression)

{

CASE constant 1: statement 1:break;

CASE constant 2: statement: break;

···················

CASE constant N: statement n;

Default: Statement n+1;break;

}

When Swich is used, the program enters a case that satisfies the condition, and then runs until it encounters the first break before it stops and jumps out of the statement.

(3) while (Judgment statement)//condition to enter the execution statement, otherwise skip the loop

Execute the statement;

Do (execute statement)//First time

while (Judgment statement), after executing once to determine whether the condition is set, if the condition is set to continue executing the DO statement

(4) for (expression; expression 2; expression 3)

EXECUTE statement

!!!!! Note the use of the For loop nested curly braces.

Using a For loop for 99 multiplication formulas

#include <stdio.h>

int main ()

{

int I, J;

for (i=1;i<10;i++)

{

for (j=1;j<=i;j++)

{

printf ("%d*%d=%d" i,j,i*j);

}

printf ("\ n");

}

}

The difference between a 8.break statement and a continue statement

The continue statement directly bundles the loop instead of terminating the entire loop, while the break statement ends the entire loop, not judging whether the entire statement is true or not.

Basic outline of C language----1

Related Article

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.