C language from entry to proficiency (1) Introduction and data types

Article directory


foreword

  本人目前是计算机大类大一的一名学生,这是本人的第一篇博客,希望能够通过写博客来记录自己学习编程的经过,记录自己成长的经过,也可以与大家分享学习过的知识。


1. What is the C language?

  C language is a general-purpose computer programming language, which is widely used in low-level development. The design goal of the C language is to provide a programming language that can be
compiled in an easy way, handle low-level memory, generate a small amount of machine code, and can run without any operating environment support
. Although the C language provides many low-level processing functions, it still maintains a good cross-platform feature. A C language program written in a standard specification can be compiled on many computer platforms, even including some embedded processors (single-chip or called MCU) and supercomputers and other operating platforms. In the 1980s, in order to avoid differences in C language grammar used by various developers, the US National Bureau of Standards formulated a complete set of American National Standard grammar for C language, called ANSI C, as the initial standard of C language . [1] Currently on December 8, 2011, the C11 standard issued by the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC) is the third official standard of the C language and the latest standard of the C language. This standard is better It supports Chinese character function names and Chinese character identifiers, and realizes Chinese character programming to a certain extent. C language is also a process-oriented computer programming language, which is different from object-oriented programming languages ​​such as C++ and Java.

2. The first C language program

    In 1972, DMRitchie of Bell Laboratories in the United States finally designed a new language based on the B language. He took the second letter of BCPL as the name of this language, which is the C language.

//第一个C语言程序
#include <stdio.h>
int main()
{
    printf("Hello World");
    return 0
}

3. Data types in C language

char //Character data type
short //Short integer
int //Integer
long //Long integer
long long //Longer integer
float //Single-precision floating-point number
double //Double-precision floating-point number
//Is there any C language string type?

The sizes of each type are:


 We can use the keyword "sizeof" in the C language to calculate the size of the space occupied by each data type, and the result is shown in the figure above, and the unit is byte (byte). If you look carefully, you will find that both the integer (int) and the long integer (long) are 4 bytes in size. This is because the C language only stipulates that sizeof(long) >= sizeof(int), and the sizes of the two can be equal.

Summarize

Here is a summary of the article:
       This blog is just a basic introduction to the C language, what is the C language, the first C language program, and the data types in the C language. In the future, I will continue to improve, be able to be proficient in C++, Java and other computer programming languages, and be able to cooperate to make satisfactory projects to meet the requirements of large factories. In the future, I will insist on writing a blog every week, and practice one or two programming questions every day. What I like most are several big factories in Shenzhen.

Guess you like

Origin blog.csdn.net/m0_74265792/article/details/129913578