Initial C language (1)

What is C language:

 The origin of C language: C language is a high-level language. Computer languages ​​are constantly developing from low-level to high-level. What is a low-level language: The earliest languages ​​were machine languages, which were binary. Code written in machine language is written in the binary sequence (010101010101), and it is very difficult to write code. What kind of binary sequence is used for what kind of function, for example, what kind of binary sequence is used for addition, and what kind of binary sequence is used for subtraction. It is very difficult to write code, and it is easy to learn. So someone came up with it later. For example, let 10010 represent addition, but the binary sequence of 10010 is difficult to remember. Can you give it a name, let’s say add. This add is used to help memorize the binary sequence. So symbols like (add) are called mnemonics. With these mnemonics , the language composed of these mnemonics is called assembly language. Later, the B language was invented on the basis of the assembly language, and the C language was invented on the basis of the B language. At this time, the language is getting more and more advanced step by step, and this time it is constantly evolving from low-level to high-level. And our C language is a high-level language, and, for example, C++, Java, and python are all high-level languages ​​commonly used by programmers today.

How to write C code: 

To write C language code, you must first write the main function.

The first is now our mainstream writing method, and the second is the old-fashioned writing method, which is rarely used now. The main function is also called the main function. The parameters in the parentheses can be written or not. I will not discuss them in detail here. I will talk about them later. Now you only need to know how to write them in the form of (main()). The following two curly brackets are called the function body. int stands for the meaning of integer (integral type). The main function will eventually return an integer value after running, the returned integer value is return 0, and return is the return. 0 is an integer, so write int in front of main, and 0 and int should be echoed back and forth. This is a fixed way of writing, just remember it. More understanding will be added over time.

If you want to print something on the screen, say hehe, you need to use printf.

printf: is a library function provided by the C language, which is specially used to print according to a specified format.

The use of library functions must include the corresponding header file → #include<stdio.h>

#include→include

stdio.h refers to →standard input output header standard input and output header file

Let's talk about the main function again. The main function is also called the main function and is the entry point of the C language program.

The execution of the C language program starts from the first line of the main function.

There is only one main function (in a project).

Getting to know the C language data types:

The char type is used to describe characters.

The two types float double are used to describe decimals.

The four types short int long long long are used to describe integers.

What is the size of each type:

sizeof is used to calculate the size of a type.

The value on the right corresponds to the size of each type, in bytes.

The smallest unit in a computer is called bit, and 8 bits are a byte (byte)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324060241&siteId=291194637
Recommended