Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function and classification of c statement

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

What is the function and classification of C sentence? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

The function and Classification of C sentence

A function is the basic unit of a C program, and a function includes a declaration part and an execution part. The execution part is composed of one or more C statements, the function of which is to issue operation and operation instructions to the computer system, requiring the corresponding operations to be performed. A C statement is compiled to produce multiple machine instructions.

According to its functions, C language statements can be divided into two categories: operation statements used to describe computer operations and operations, and process control statements used to control the order of operation execution.

1. Expression statement

The operations and operations in C language are realized by expressions, and expression statements are widely used in programs. For example:

IBesides + / / this is an expression, not a statement

After execution, add 1 to the value of I

But it doesn't make any sense. After execution, the result of the operation is not saved, and the values of x and y remain unchanged.

(1) assignment statement

The assignment statement is composed of a semicolon after the assignment expression, and its function is to change the value of the variable.

For example:

I=x+y

(2) function call statement

The function call statement is composed of a semicolon after the function call expression, and its function is to make the called function executed.

For example:

Printf ("hello world.\ n")

(3) empty sentence

An empty statement consists of a semicolon.

two。 Flow control statement

The C language provides nine kinds of process control statements, which can be roughly divided into the following categories:

Select structure control statement: if … Else and switch

Loop structure control statements: for, while and do. While

End the loop statement: continue

Terminating loops and multiple branch statements: break

Unconditional transfer statement: goto

Function return statement: return

3. Compound statement

The C language allows one or more statements to be enclosed in curly braces {} to form compound statements, also known as statement blocks.

The answer to the question about the function and classification of c sentence is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report