Girls can also confidently break the C language

Source: Internet
Author: User
Tags arithmetic operators types of functions

vaguely remember one months ago began to learn C, panic, from the ear heard a lot of voices, "Girls learn C more difficult", "This is very logical ...."

"May I?" ”。

The curriculum is scheduled to arrive. "No matter what others say, I will try, experience, and strive to make a final conclusion!" "With this mindset, until now C's course review is over and ready to start the project.

When I finished my system to learn C, I found that many times only myself to learn, will find out how much learning potential. And the other person's words are only a precedent. For reference only.

The c we study is divided into 9 chapters.

Chapter One: Overview of software development

This chapter as the first chapter, the natural focus is not many, in addition to understand the computer language is divided into: machine language, assembly language, high-level languages, binary and decimal between the conversion, more need to understand the master

An expression in the algorithm-flowchart. Will look at the flowchart, will be drawn by the drawing flowchart is a basic skill. In addition to this, we can also briefly learn how to create a C program in this section:

1, write the source code;

2, the source code compiled into the target code;

3, link the target code to become an executable program.

Chapter II: Programming Language Overview

In this chapter we can know "why C as an example", "the basic composition of programming language", "the basic structure of C program", "C language of the computer implementation process" The 4 large plates.

First of all, we must know that C is not the most primitive programming language, before C there is a B language. C, as an intermediate language, combines the basic structure of high-level language with the efficient practicality of low-level language, which is an excellent and effective modern universal programming language. So we start with C, learn the basic knowledge that most programming languages have in common, so that we can learn other programming languages later, without having to start with the most basic things every time!

second, the basic composition of the programming language:

1, Character set, also includes: numeric characters, Latin characters, operators, special symbols and non-display characters;

2, the identifier, in C, the identifier is the C language character set of letters, numbers or underscores, its first character must be a letter or an underscore;

3, the key word, began to contact feel this key word a lot, but learned the later chapters, only to find that every day, unfamiliar only strange feeling! But remember: the keyword cannot be used as an identifier.

4, statements, statements are the basic unit of the constituent program. Keywords and identifiers make up statements according to certain grammatical rules.

5, the standard library function, which is organized by the company some common application functions, written into a standard program release, so as to facilitate our development, reduce the amount of code.

Third, the basic structure of C program

After the detailed introduction of the book, it is entirely up to the individual to understand that the basic structure of the C program is as follows:

1, #include指示和头文件;

2, main () function;

3, comments, curly braces, program body, code block;

4. Statement (this is one of the most important functions in C)

5. Assign Value

6, printf () function and return statement.

Finally, C language of the computer execution process: Edit C source program-Edit C source program-Program link-run the program.

Chapter III: Data storage and input and output

This chapter I think the total is divided into the title of the two sections: "Data Storage" and "data input and output", but must master the various types of data in the programming language (after the discussion).

First, for data storage, we need to know that the data is stored as bytes in the computer. (1 bytes ==8 bit)

We need to know that any data has 2 types of user representation: constants or variables. Constant refers to the amount of the value of the program when it is run, and the representation of the data in the programming language, whereas the variable is the amount that the value can change while the program is running, and we can store the data with variables.

Constants are generally divided into literal and symbolic constants.

Literal is subdivided into: integer constant, real type constant, character constant, string constant. The first 3 kinds are the basic data types we use, and the last one is then the eighth chapter of the complex data type-the array of characters.

In symbolic constants, we often use macro definitions in the form of: #define Identifier constants

variables, we need to grasp the variable definition, variable declaration, variable assignment, (in the variable we can declare after the assignment, you can declare the variable at the same time to assign a value), a reference to the variable.

Second, the input and output of the data, we often use the scanf () function with the printf () function. The two functions behave as follows:

printf ("Format control string", Output table column)

scanf ("Format control string", Address table column)

The biggest difference between the two is that the format control string in the printf () function has a display effect, but not in scanf ().

Fourth chapter: Operators, expressions, statements

First, we need to know that a simple expression consists of a constant or a variable (that is, contains a simple operand); a complex expression consists of several simple expressions that are concatenated between expressions with an operator.

Second, we need to understand the size of the various operators and their priority levels:

Arithmetic operators include: +-*/operator, modulo operator% (for integer operations) the answer to Eg:13%5 is: 3;

Assignment operator: eg:a=2; Assign a value of 2 to A;

Increment and decrement operators, divided into prefixes: eg: ++i 、--i; and suffix form: i++, i--;

Relational operators: (>=, >, <=, <,) have higher precedence than (= =,!). =

Logical operators:&&, | |,! ;

Conditional operator: expression 1? Expression 2: Expression 3;

The precedence of these types of operators is from large to small, in turn:! , arithmetic operators, relational operators, && and | |, conditional operators, assignment operators;

There is another class: the Special Operator: sizeof (OPR) and the Fetch operator & (both single-mesh operators).

Third: statement, the classification of statements:

Process Control Statement: Select Class statement, loop statement, transfer statement;

An expression statement;

Compound statement;

Empty statement.

the fifth chapter: the programming of selecting structure

This chapter mainly uses if and swith to design the choice statement, simultaneously grasps two kinds of design statement's nesting relation.

the sixth chapter: design of cyclic structure

Loop This chapter, mastering the Do_while, while, for three basic loops, where for is the most flexible and most commonly used a cycle, but only for the number of cycles to determine the case;

In addition, the difference and effective use of break, continue statement;

Break statement, refers to jump out of the loop body, you can end the running of the statement, break can also be applied in switch, and the Continue statement refers to the end of the loop, the next cycle.

The functions of the loop are powerful and frequently used, as long as there are repetitive regularity things can be used on the loop. And in-depth understanding of the cycle, but also a breakthrough in C an important skill.

Seventh chapter: Arrays and Strings

When most people jam in the loop, I'm stuck in this block of arrays.

An array is a complex type of data that is arranged in a certain order, with a set of similar variables of the same nature. These variables have the same name and data type, are arranged in memory sequentially, and are distinguished by subscripts, so they are also called subscript variables. Eg:int a [8];

Array learning, we touch one-dimensional arrays and two-dimensional arrays.

The first dimension array is defined as an integer constant expression, and the two-dimensional array is defined as an integer-shaped constant expression, representing both rows and columns;

Whether one-dimensional or two-dimensional arrays are variables, we have to learn to initialize and apply them, which requires a lot of practice to support.

and the character and string have been explained in the third chapter, the character array is specially used to store the string, also known as "string variable", and we also know here that strcmp is used for 2 string comparisons, while strlen is used to output the length of a string.

This chapter of the array is one of the most exhausting chapters I have learned. Suddenly change the type of data, the total feeling array is unfathomable, but on the basis of repeated reading, the appropriate practice, in fact, a lot of problems will be solved.

Eighth chapter: Complex Data Types

Entering this chapter, we can fully understand the data types that are not mentioned in chapter Iii.

The C language data type is divided into four chunks:

Base type: integer int, float float, double, char Char

Pointer type

Constructed type: array, struct struct, union union, enum Enum,

Empty type void,

The difference between a struct and a common body:

The memory length of the former variable is greater than or equal to the sum of the memory length of each member;

The memory of the latter variable equals the length of the longest member.

An enumeration class, as the name implies, lists the desirable values for this type of data. The form is as follows:

Eg:enum Weekday (Mon, Tue, Wed, Thu);

Pointer type I also do not fully understand and grasp, for the moment not mentioned.

the Nineth Chapter: Modular Programming methods and functions

C program is composed of function, function is the important concept in C language, but the important means of program design. Using functions can improve the efficiency of programming, eliminating the duplication of writing, inputting, and editing of the same program segments.

Modular programming refers to: usually a large program by function into a number of smaller modules, each module written into a clear structure, simple interface, easy to understand the program segment---function.

There are two types of functions: one is the standard function provided by the system and the other is the user's own defined function.

Functions are used, including function definitions, function declarations, and function calls.

From the formal view of function, the function is divided into two classes: the function of no parameter and the function of parameter.

When defining a function, the parameter is called formal parameter, or parameter of calling function is called argument, the relation between formal parameter and argument is: The number must be consistent, the type must be consistent, and the order must be consistent;

From the value of the function, the function is divided into: a function with no return value and a function with a return value.

Here's how I really feel about C:

Learn c start really do not touch the mind, for a development environment of the dazed, to the back slightly familiar when, do some about the logic training, such as: solid diamond, etc., sometimes do is 1 hours, but the results are often unsatisfactory, there are all kinds of error and warning. But to calm down the mood, and then another way of thinking continue to start, often there is "vista" feeling.

In fact, I think repeated failure is the only way to success, although the heart has been hit, but a different mentality, it is every time from failure to learn something is their own to maintain the forward capital.

I think in addition to the importance of practical operation, don't forget to read!!!!!! All the knowledge points are from the book, there is no theory as a support, it is just "on paper".

Very looking forward to the project training, even if still a lot of failure in waiting for themselves, but that fear?

Girls can also confidently break the C language

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.