Basic concepts of C language

Source: Internet
Author: User

1. Standard C language

The C language was born in the 1970s, older than ourselves, and produced many standards, but various compilers support different standards.

ANSI C is the most widely used standard and is also the first formal standard, known as "Standard C language". ANSI C was released in 1980 by the U.S. National Bureau of Standards (American Nation Standards Institute, abbreviation ANSI), the various compilers almost complete support ANSI C, books on the market, teaching materials in the university, Most of the tutorials on the Web are based on the ANSI C, and the C language Chinese network is no exception, and is based on ANSI C.

The variable name, function name, label, etc. used in the program are collectively called identifiers. Except for the function name of the library function, which is defined by the system, the rest is customized by the user.

Popular Science:

The C language was introduced in November 1972, and in 1978 the American Telephone and Telegraph Company (T) Bell Laboratory formally released the C language, 1983 by the United States National Standards Bureau (American Nation standards Institute, ANSI) began to develop the C language standard, completed in December 1989, and released in the spring of 1990, called ANSI C, sometimes referred to as C89 or C90.


The father of C language--Ricky


Before we learn the C language, let's look at the history of C language first.

C language is a universal, modular, programmatic programming language, is widely used in operating systems and application software development. Due to its high efficiency and portability, it is favored by developers to adapt to different hardware and software platforms.

Early development of C language

The initial development of the C language began in 1969-1973 at Bell Labs at the American Telephone and Telegraph Corporation (t). According to the C language inventor Dennis Ritchie (Dennis Ritchie), the most important period of research and development in C language is in 1972 years.

Description: Dennis Ritchie (Dennis Ritchie), father of C language, father of Unix. 1978 with Blaine Cornigan (Brian Kernighan) published the famous "C programming language (the C programming Language)", now the book has been translated into multiple languages, the C language is one of the most authoritative teaching materials. October 12, 2011 (Beijing time is October 13), Dennis Ritchie died at the age of 70.

C was named C because the C language originated from the B language invented by Ken Thompson, whereas the B language originated in the Bcpl language.

The birth of C language and the development of UNIX operating system is inseparable, the original Unix operating system is written in assembly language, 1973 UNIX operating system core in C language rewrite, since then, C language has become the main language to write the operating system.

K&r C

In 1978, Dennis Ritchie (Dennis Ritchie) and Blaine Cornigan (Brian Kernighan) published a book called "The C Programming Language" (the Chinese name is "C programming language"). The book is called "K&r" by C-language developers and has been used for many years as an unofficial standard for C. People call this version of the C language "K&r C".

In 1988 Dennis Ritchie (Dennis Ritchie) and Blaine Cornigan (Brian Kernighan) revised the book, published the second edition of the C programming Language, and the second edition covered the ANSI C language standard. the Second Edition has since become the university computer education about C language Classics textbook, many years later also did not appear the better version.

ANSI C and ISO C

In the 1970-80 's, C language was widely used, from mainframe to small microcomputer, also derived from the C language of many different versions.

In order to unify the C language version, a committee was set up in 1983 by the National Bureau of Standards (American Nation Standards Institute, abbreviated as ANSI) to develop the C language standard. The 1989 C language standard was approved, known as ANSI x3.159-1989 "programming Language C". This version of the C language standard is commonly referred to as ANSI C. And since this version was completed in 89, it is also known as C89.

later, ANSI submitted this standard to ISO (International Standards Organization), which was adopted by ISO in 1990 as an international standard, called ISO C. And because this version was released in 1990, it is also known as C90.

ANSI C (C89) is basically the same as the ISO C (C90) content, mainly the format organization is different.

because ANSI and ISO C standard content is basically the same, so for the C standard, can be called ANSI C, also can be said to be ISO C, or Ansi/iso C.

Note: In the future you will see ANSI C, ISO C, C89, C90, to know that the content of these standards are the same.

Currently, almost all development tools support ansi/iso C standard. Is the most widely used standard version of C language.

C99

After the ANSI C standard was established, the C language specification did not change much over a long period of time. In 1995, the C programming language Working group revised the C language to become the ISO/IEC 9,899:1999 standard, which was released in 1999, and is often C99.

But each company's support for C99 has shown a different interest. When GCC and some other commercial compilers supported most of C99 's features, Microsoft and Borland seemed uninterested.

Description: GCC (GNU Compiler Collection,gnu Compiler Collection) is a set of compilers developed by the GNU project that support multiple programming languages.

To sum up, the current widely used C language version is ansi/iso C, the most classic C language teaching material is "C programming language (the C programming Language) second Edition."


The influence of C language on other languages in C language version change history

Many programming languages are heavily influenced by C, such as C + + (an extension of the C language, for example) in C #, Java, PHP, Javascript, Perl, LPC, and UNIX.

Also because of the influence of C language, Master C language, and then learn other programming languages, most can quickly get started, comprehend by analogy, many universities will C language as the introductory language of computer teaching.

2. Identifiers

In the C language, identifiers can only be strings consisting of letters (A~Z, a~z), Numbers (0~9), and underscores (_), and the first character must be a letter or an underscore. The following identifiers are valid: A, X, X3, Book_1, sum5 the following identifiers are illegal: 3s begins with a number s*t illegal characters * -3x with a minus sign (-) bowy-1 appears illegal character minus sign (-)

In Fedora 21, the length of the identifier is not limited, but it is not restricted by the GCC compiler, and the code executes normally.

1#include <stdio.h>2 intMain ()3 {4     intAbcdefgsjdfshfkshfkshfkjshifhweiuthrewuiriweuhriuwehweudefgsjdfshfkshfkshfkjshifhweiuthrewuiriweuhriuwehweudefgsjdfshfksh Fkshfkjshifhweiuthrewuiriweuhriuwehweudefgsjdfshfkshfkshfkjshifhweiuthrewuiriweuhriuwehweudefgsjdfshfkshfkshfkjshifhweiut Hrewuiriweuhriuwehweudefgsjdfshfkshfkshfkjshifhweiuthrewuiriweuhriuwehweudefgsjdfshfkshfkshfkjshifhweiuthrewuiriweuhriuwe hweuihgfdiwehfuiwehfuiwehfiwehfiewhfiuhweihsiuhf=0;5printf"Hello World");6     return 0;7}

3. Keywords

Keywords are strings that are specific to the C language and are often referred to as reserved words. User-defined identifiers should not be the same as keywords.

The C language keywords fall into the following categories:

category Description
Type descriptor A type used to define, describe a variable, function, or other data structure. such as the int, double, etc. used in the previous example.
Statement-Definition character The function used to represent a statement. The If else used in example 1-3 is the statement definition of the conditional statement.
preprocessing command word Used to represent a preprocessing command. Include as used in the previous examples.
4. Operators

The C language contains a fairly rich list of operators. Operators, together with variables and functions, form an expression that represents various arithmetic functions. An operator consists of one or more characters, such as a plus sign (+), a minus sign (-), a multiplication sign (*), and so on.

5. Separators

The delimiter used in C is separated by a comma (,) and a space. Commas are used primarily in the type description and function parameter tables, separating each variable. A space is used to make a spacer between the words of the statement. In the keyword, there must be more than one character space between identifiers, or there will be a syntax error, such as the int A; Written as Inta; The C language compiler treats Inta as an identifier, and the result is bound to go wrong.

6. Constants

Constants are the amount of values that cannot be changed. The constants used in C can be divided into numeric constants, character constants, string constants, symbolic constants, escape characters, and more. The introduction will be given in a later chapter.

7. Variables

Variables are named by the user to hold specific types of data, and the data can be changed. Data types are integers, floating-point numbers, characters, and so on, which are described in later chapters.

8. Notes

The standard C language comment is a string that begins with "/*" and ends with "*/". The comment is between "/*" and "/*". When the program compiles, no comments are processed. Comments can appear anywhere in the program. Comments are used to prompt or explain the meaning of the program to the user. Statements that are not used in the debugger can also be enclosed in annotations so that the translation is skipped and the comment is removed after the debug is finished.

In addition, various compilers support comments beginning with "//", although it is not a standard C, but it is already a fact standard and is widely used in programs. "//" only supports single-line comments, that is, line breaks are not allowed in comments, and "/* * * * *" supports multiple lines of comments, and newline characters can appear in comments.

Basic concepts of C language

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.