The first day of the C language learning process

Source: Internet
Author: User
Tags arithmetic operators bitwise operators

Introduction to C language

C language is a universal, process-oriented computer programming language. In 1972, in order to transplant and develop the UNIX operating system, Dennis Ritchie designed and developed the C language in Bell Telephone lab.

C is a widely used computer language that is as popular as the Java programming language, and is widely used by modern software programmers.

Basic knowledge

C is a general-purpose, high-level language originally designed by Dennis Ritchie to develop UNIX operating systems at Bell Labs. The C language was first implemented on the DEC PDP-11 computer in 1972.

In 1978, Blaine Collingham (Brian Kernighan) and Dennis Ritchie (Dennis Ritchie) made the first publicly available description of C, now known as the K&r standard.

UNIX operating systems, C compilers, and almost all UNIX applications are written in C. For various reasons, C language has now become a widely used professional language.

Easy to learn.

    • Structured language.

    • It produces high-efficiency programs.

    • It can handle the underlying activity.

    • It can be compiled on a variety of computer platforms.

C Language Compilation Software

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/9D/BF/wKioL1mFTDLRYPhuAAFPOq1UAp0118.png-wh_500x0-wm_ 3-wmp_4-s_3379875332.png "style=" Float:none; "title=" 2017-08-05_12-38-54.png "alt=" Wkiol1mftdlryphuaafpoq1uap0118.png-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9D/BF/wKioL1mFTDOCS48sAAB7SkZaCwk496.png-wh_500x0-wm_ 3-wmp_4-s_3199007620.png "style=" Float:none; "title=" 2017-08-05_12-39-10.png "alt=" Wkiol1mftdocs48saab7skzacwk496.png-wh_50 "/>

What I'm using is vs2017 and dev C + +

C Language Program composition and the simplest HelloWorld


The C program mainly includes the following parts:

    • Preprocessor directives

    • Function

    • Variable

    • Statements & Expressions

    • Comments

The simplest from the language program Hello World, the first software written by the Basic programming prophecy is Hello World

Let's look at a simple code that can output the word "Hello World":

#include <stdio.h>

int main ()

{

printf ("Hello World");

return 0;

GetChar ();

}

The first line of the program #include <stdio.h> is the preprocessor directive, which tells the C compiler to include the Stdio.h file before actually compiling it.

The next line of int main () is the main function, where the program starts execution.

The next line of printf (...) is another available function in C that displays the message "Hello, world!" on the screen.

The next line of return 0 terminates the main () function and returns the value 0.

The next line of GetChar () is to let you see the effect

C Language Common data types

Integer type

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/9D/BF/wKioL1mFTsezJgFWAABWKzlR0cw027.png-wh_500x0-wm_ 3-wmp_4-s_3280855208.png "title=" 2017-08-05_12-50-12.png "alt=" Wkiol1mftsezjgfwaabwkzlr0cw027.png-wh_50 "/>

Floating-point types

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/9D/C0/wKiom1mFTtSw4QCBAAAsPNUOwYo979.png-wh_500x0-wm_ 3-wmp_4-s_1935944406.png "title=" 2017-08-05_12-50-24.png "alt=" Wkiom1mfttsw4qcbaaaspnuowyo979.png-wh_50 "/>

C Language Annotation method

Multi-line Comment/**/

Single-line comment//

Variables in the C language

A variable is simply the name of a store that the program can manipulate. Each variable in C has a specific type, and the type determines the size and layout of the variable store, and the value in that range can be stored in memory, and the operator can be applied to the variable.

The name of a variable can consist of letters, numbers, and underscore characters. It must start with a letter or an underscore. Uppercase and lowercase letters are different because C is case-sensitive. Based on the basic types explained in the previous chapter, there are several basic types of variables:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/9D/C0/wKioL1mFT9uBJl5XAAA4nW-xD5Q673.png-wh_500x0-wm_ 3-wmp_4-s_636369328.png "title=" 2017-08-05_12-54-53.png "alt=" Wkiol1mft9ubjl5xaaa4nw-xd5q673.png-wh_50 "/>

C Language Constants

Constants are fixed values that do not change during program execution. These fixed values are also called literal quantities .

Constants can be any of the basic data types, such as Integer constants, floating-point constants, character constants, or string literals, as well as enumeration constants.

constants are like regular variables, but the values of constants cannot be modified after they are defined.

There are integer constants, floating-point constants, string constants, defining constants (the first three good understandings focus on defining constants).

In C, there are two simple ways to define constants:

    1. Use #define preprocessor.

    2. Using the const keyword

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/9D/C0/wKioL1mFUOyi3_m4AAB-ftWZI8A162.png-wh_500x0-wm_ 3-wmp_4-s_2759514708.png "style=" Float:none; "title=" 2017-08-05_12-59-14.png "alt=" wkiol1mfuoyi3_ M4aab-ftwzi8a162.png-wh_50 "/>

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9D/C0/wKiom1mFUO2wA5PkAACSRUlbuhA051.png-wh_500x0-wm_ 3-wmp_4-s_2922577117.png "style=" Float:none; "title=" 2017-08-05_12-59-30.png "alt=" Wkiom1mfuo2wa5pkaacsrulbuha051.png-wh_50 "/>

C-language operators

An operator is a symbol that tells the compiler to perform a specific mathematical or logical operation. The C language has rich operators built into it and provides the following types of operators:

  • Arithmetic operators

  • Relational operators

  • logical operators

  • Bitwise operators

  • Assignment operators

  • Miscellaneous operators

  • 650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/9D/C0/wKioL1mFUxjgU9PoAAB43EQZuRo293.png-wh_500x0-wm_ 3-wmp_4-s_1692994510.png "style=" Float:none; "title=" 2017-08-05_13-02-32.png "alt=" Wkiol1mfuxjgu9poaab43eqzuro293.png-wh_50 "/>

  • 650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/9D/C0/wKioL1mFUxjiGEEBAACOVrb9S1A735.png-wh_500x0-wm_ 3-wmp_4-s_1480276083.png "style=" Float:none; "title=" 2017-08-05_13-02-46.png "alt=" Wkiol1mfuxjigeebaacovrb9s1a735.png-wh_50 "/>

  • 650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/9D/C0/wKiom1mFUxmRKFDuAABra_wG7jg434.png-wh_500x0-wm_ 3-wmp_4-s_307883483.png "style=" Float:none; "title=" 2017-08-05_13-02-56.png "alt=" Wkiom1mfuxmrkfduaabra_ Wg7jg434.png-wh_50 "/>

  • 650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/9D/C0/wKioL1mFUxqSSlt-AAAqVd4w4A8259.png-wh_500x0-wm_ 3-wmp_4-s_662185262.png "style=" Float:none; "title=" 2017-08-05_13-03-09.png "alt=" Wkiol1mfuxqsslt-aaaqvd4w4a8259.png-wh_50 "/>

  • 650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/9D/C0/wKiom1mFUxvzfrMnAAC4vMj-Ewg278.png-wh_500x0-wm_ 3-wmp_4-s_3082915564.png "style=" Float:none; "title=" 2017-08-05_13-03-52.png "alt=" Wkiom1mfuxvzfrmnaac4vmj-ewg278.png-wh_50 "/>

  • 650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/9D/C0/wKiom1mFUxzQ8-X5AAC5WEm2X74383.png-wh_500x0-wm_ 3-wmp_4-s_425228988.png "style=" Float:none; "title=" 2017-08-05_13-04-14.png "alt=" Wkiom1mfuxzq8-x5aac5wem2x74383.png-wh_50 "/>

  • 650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/9D/C0/wKioL1mFUxyhiK_eAAA21mKKolA168.png-wh_500x0-wm_ 3-wmp_4-s_1308950628.png "style=" Float:none; "title=" 2017-08-05_13-04-34.png "alt=" Wkiol1mfuxyhik_ Eaaa21mkkola168.png-wh_50 "/>

  • Operator Precedence in C
  • The precedence of an operator determines the combination of items in an expression. This affects how an expression is evaluated. (Not detailed)








This article is from the "11772222" blog, please be sure to keep this source http://11782222.blog.51cto.com/11772222/1953794

The first day of the C language learning process

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.