C-Language Foundation-fifth chapter

Source: Internet
Author: User

Process Control

1. Sequential structure

Sequential structure means that the program executes the program in the order in which it is written.

2. Select structure

2.1 But branch structure statements

if (expression) {statement}

2.2 Dual-branch structure

if (expression) {}else if{} else{}

2.3 Multi-branch Structure statement

Switch ()

{

CASE constant: statement break;

Case .... break;

Default: Statement break ;

}

2.4-bar operators and conditional expressions

max= (a>b)? A:B;

A is greater than B if the condition is set then take a value, if the condition is not set to go to B

3. Cyclic structure

For, Goto, while, do-while

3.1 For statement

For (search variable assignment; loop condition; loop variable add value) {}

3.2 While statement

while (expression) {statement}

3.3do-while

Is the constant execution of a statement while (condition is set) jumps out

Do

Statement

while (condition)

3.4 Goto

Perform any structure

3.5 break

The concluding sentence jumps out of the loop;

3.6 Continue

Executes the next statement

3.7 Dead Loop and exit program

Exit (1); Exit function

  

C-Language Foundation-fifth chapter

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.