C Language Learning second-c language basic learning, language learning second-c

Source: Internet
Author: User

C Language Learning second-c language basic learning, language learning second-c

1. Standard C Language

C language was born in 1970s. It was older than ourselves. Many standards were generated during this period, but various compilers have different support for the standards.

Ansi c is the most widely used standard and the first formal standard, known as "Standard C language ". Ansi c was released by the American National Standards Institute (ANSI) in 1980. Almost all compilers support ansi c, most books on the market, university textbooks, and online tutorials are based on ansi c, and the C language Chinese network is no exception. It is also based on ansi c.

If you encounter other terms, such as iso c, C89, C90, ANSI/iso c, you must know that all these terms refer to a version. For details, refer to the C language development and version.

2. identifier

The variables, function names, and labels used in the program are collectively referred to as identifiers. They can be composed of "A-Za-z" "0-9" and underscores, the library function is defined by the system. In addition, the first character of the function must consist of letters or underscores and cannot begin with other characters;

The following identifiers are valid:
A, x, x3, BOOK_1, sum5

The following identifier is invalid:

3 s starts with a number
S * T contains invalid characters *
-3x starts with a minus sign (-).
Invalid bowy-1 minus sign (-)

Note:

Standard C language does not limit the length of identifiers, but it is limited by the C language compilation systems of various versions and by specific machines. For example, in a certain version of C language, the first eight bits of the identifier are valid. When the first eight bits of the two identifiers are in the same phase, they are considered to be the same identifier.

In identifiers, the Case sensitivity is different. For example, BOOK and book are two different identifiers.

Although the identifier can be defined by the programmer at will, it is a symbol used to identify a certain amount. Therefore, naming should be meaningful as much as possible to facilitate reading and understanding, as the name suggests ".

3. Keywords

A keyword is a string of specific meaning specified by the C language. It is also known as a reserved word. User-Defined identifiers should not be the same as keywords.

Some common keywords:

Category Description
Type specifier Defines and describes the types of variables, functions, or other data structures. For example, int and double used in the previous example.
Statement delimiter Indicates the function of a statement. For example, if else used in [Example 1-3] is the statement Definition character of the Condition Statement.
Preprocessing command word Used to represent a preprocessing command. For example, include is used in the previous examples.


For all the keywords, refer to here: C language keywords and their explanations [32 in total]

4. Operators

The C language contains rich operators, operators, and variables. functions are combined into expressions to represent various computing functions. Operators are composed of +.

5. Separator

In C language, there are two separator: comma and space. comma is mainly used in type description and function parameters to separate variables. Space is used as the delimiter between words in a statement. In the keyword, there must be more than one space character between identifiers as an interval, so it is better to have a syntax error, such as writing int a; into inta; the C language editor treats inta as an identifier and the result is obviously incorrect.

6. Constants

A constant is the amount that a value cannot be changed. Constants used in C can be divided into numeric constants, character constants, string constants, symbol constants, and escape characters. I will not detail them here.

7. Variables

A variable is named by the user. It is used to save data of a specific type. The data can be changed. The data types include integers, floating-point numbers, and characters.

8. Notes

A string starting with/* and ending with */in the Standard C language. Comments between/* and */are not processed during program compilation. Comments can appear anywhere in the program. Annotations are used to notify users or explain the meaning of a program. In the debugging program, you can also comment out the statements that are not currently used, so that compilation is skipped and not processed. After the debugging is complete, you can cancel the comments.

In addition, // is also used as annotation in many compilers. Although it is not a C language standard, it has already become a fact standard. It only supports single-line annotation and/**/supports multi-line annotation.

 




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.