Summary of C language learning: From keywords to cyclic structure, language learning keywords

Source: Internet
Author: User
Tags arithmetic operators

Summary of C language learning: From keywords to cyclic structure, language learning keywords

I. keywords and identifiers

1. Keyword: c indicates that all the words with special meanings (that is, the names starting from the system) are in lowercase and contain 32 words;

Data Type and process type derived from keywords

1. Category:

(1) Data Type: int indicates the integer type, char indicates the dense type, and float or double indicates the real type (floating point type ).

(2) process type: Sequence Structure, selection structure, and Cycle Structure

Data types can be further classified, that is, data types can be classified into constants and variables.

(1) constant: integer, real (floating point, that is, decimal) Numeric (common character, transfer character, string type)

(2) variables: they also contain integer, real, and complex types.
Definition, initialization, use, global and local, memory Analysis

2. The identifier (User Name). Note that main is the identifier, but it is also required by the system. Then, it introduces the naming rules and specifications of the identifier.

Ii. Notes: Explanation of code in human language

3. input and output of the program

1. Input Function: scanf function, that is, input of various data types
Introduction
2. output function: printf function, which Outputs Various Data Types
Introduction

4. Operators: for various types of data operations

Involved in priority and combination

1. Arithmetic Operators: addition, subtraction, multiplication, division, modulo
2. Value assignment operator: simple value assignment operator and compound value assignment operator
3. auto-increment and auto-increment operators: result ++ (, First calculation and then auto-increment) or ++ result (first, auto-increment the variable and then the result after auto-increment are involved in the operation, that is, First Auto-increment and then calculate)
4. sizeof OPERATOR:
5. Comma OPERATOR: knows as a delimiter.
6. Relational operators: ><==! =
7. logical operators: & logical and (one false and one false), | logical or (one true and one true ),! Logical non-operation (reverse)
8. Three-object OPERATOR: Condition expression? Result A: Result B. If the condition expression is true, return A, false, and return B.

5. Combination and priority of operators, return values

1. concatenation: associativity refer to the order in which the program executes the operator, for example, the left combination refers to executing the code on the left of the operator before executing the code on the right.
2. Operator priority: the priority is the comparison between different operators. It compares which operator is executed when multiple operators appear at the same time. The priority of the First operator is high.

Format, Return Value

3. After the operator is executed in c, return values are returned. Some return true or false values, and some return numerical values.

6. Process Control: in order to make the program more exciting, it is similar to writing an article in different ways when writing an article. Some write the plain text, and some write the ups and downs, making the article more exciting.
How to reflect this difference in writing programs is through process control. Essentially, process control is like organizing text when writing. Process Control * is used to organize the execution of a line of code, that is, various * Data * input and output methods.
1. This leads to the order structure. Select the structure and cycle structure.
The composition and format of the three process structures. Note:
2. Select the structure category:
2.1 if five formats:
(1) if (condition expression) {statement ;...}
(2) if (condition expression) {statement ;..}
Else {statement ;..}
(3) if (condition expression) {statement ;..}
Else if (conditional expression) {statement ;..}
Else if (conditional expression) {statement ;..}
...
Else {statement ;..} Note:
(4) if (conditional expression) Statement ;..
(5) if nesting
If (conditional expression)
{
If (condition expression) {} else {statement ;..}
} Else {statement ;..}
2.2switch format: switch (conditional expression)
{
Case INTEGER:
Statement;
Break;
Case INTEGER:
Statement;
Break;
...
Default:
Statement;
Break;
}
3. Loop Structure
(1) while format: while (conditional expression)
{
Statement;
... (Loop part)
}
(2) do while format:
Do {statement;...} while (conditional expression );
(3) for format (initialization expression; conditional expression; Incremental expression after loop)
{
Statement ;...}

 

Conclusion: by observing the above red font, we can find that:

Keywords, identifiers, operators, process control, and input/output functions are all serving different types of data. Therefore, the code can be simply understood as: What type of data should I enter, which operations are then performed on the data, and the form and sequence of the operations are controlled by the process to ultimately output the desired data?

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.