Before you learn C, you have to understand it


Since the early 1980s, when C was the dominant language in the UNIX world of minicomputers, it has been extended to personal computers and mainframes, and most software developers have chosen C to develop their subprocessors, spreadsheet software, compilers, and so on. Because they know that C can produce compact and efficient programs. More importantly, they know that these programs are easy to modify and easy to adapt to new computer models.

What is helpful for companies and people familiar with the C language is equally helpful for other users. More and more computer users have turned to C to take advantage of its benefits. You don't have to be a computer professional to use C.

And by the 1990s, many software developers were turning to C++ for big programming projects. C++ grafted object-oriented programming tools on to C (object-oriented programming is a philosophy that tries to let the language adapt to the problem, rather than letting the problem adapt to the language). C++ is pretty much a superset of C, meaning that any C program is simultaneously, or pretty much, a valid C++ program. By learning C, you will be able to pick up much of what C++ has to offer more easily.

Regardless of the popularity of newer languages like C++ and Java, C is still an important skill in the software industry, and it is generally listed in the top 10 of the most desired skills. In particular, C also makes up for or is missing in programming embedded systems. That is, it will be used to program the microprocessors that are becoming popular in cars, cameras, DVD players and other modern devices. Likewise, C has begun to enter the realm of scientific programming that has long belonged to FORTRAN. Finally, because it is a suitable language for developing operating systems, C also plays an important role in the development of Linux. Even now, C will remain strong.

In short, C is one of the most important programming languages and will continue to be so, and if you want a job in programming, one of the first things you can't afford to be without is the ability to use C.

Basic principles of how computers work

I recommend a learning C language / C++ learning skirt [ six six six, two nine five, four nine eight ] invitation code Lingyun, whether you are a big cow or white, is to switch or want to enter the industry can come to understand together with progress together with learning! There are dev tools in the skirt, lots of dry and technical material to share!

calculators

If you intend to learn how to program in C, you will have to know something about how computers work. This knowledge will help you better understand the connection between writing a program in C and what will eventually happen when you run that program.

Nowadays, computers can be divided into several components. The central processing unit (CPU) does most of the computing; random access memory (RAM) serves as a workspace to hold programs and files; permanent memory, usually a hard disk, keeps track of programs and files even when the computer is turned off; and various external input and output devices (e.g., keyboard, mouse, printer) are used to provide communication between the person and the computer. The CPU is responsible for processing the program, so let's concentrate on its functions.

CPU

The CPU's job is very simple, at least as far as we know. It fetches an instruction from memory and executes that instruction, then fetches the next instruction from memory and executes it, and so on and so forth. A gigabit CPU can perform about 100 million such operations in a single second, so the CPU can perform extremely tedious tasks at a staggering rate that might break a person's spirit if performed by human hands. The CPU has its own small workspace that consists of several registers, each of which can hold a single number. A register holds the memory address of the next instruction, and the CPU uses this information to fetch the next instruction. After fetching an instruction, the CPU saves the instruction in another register and updates the value of the first register to the address of the next instruction. The CPU can only understand a limited number of instructions (instruction set). What's more, these instructions are quite specific, and many of them require the computer to move a number from one location to another, for example, from a memory cell to a register.

There are two interesting points in this note. First, everything stored in a computer is digital. Numbers are stored in numeric form, and characters are stored in numeric form, each with a numeric code (ASCII). Instructions loaded into registers by the computer are stored in digital form, and each instruction in the instruction set has a digital code. Second, computer programs must ultimately be represented in this numerical instruction code (or machine language).

Once you understand how computers operate: if you want a computer to do something for you, you must provide a specific list of instructions that tell the computer exactly what to do and how to do it; the computer is dead, he will only do what you command. You must create the program in a language that the computer can directly understand (machine language). It's a tedious, tedious, laborious task. Even something as simple as the two think-backs must be broken down into steps.

1 Copy the number in memory cell for 2000 to register 1.

2 Copy the number in memory cell for 2004 to register 2.

3 Add the contents of register 2 to the contents of register 1, keeping the answer in register 1.

4 Copy the contents of register 1 to memory cell 2008.

And you have to represent each of these instructions in numeric code!

If you prefer to program in this way, sorry, the days of machine language programming are long gone.

And if you still want to learn to program, then you can learn advanced programming languages.

Advanced computer languages and compilers

A high-level programming language such as C can simplify your programming process in several ways. First, you don't have to use numeric code, i.e. ASCII, for instructions. Second, the instructions you use are closer to the way you think about the problem than they are to the detailed operational steps used by the computer. Instead of thinking about the exact steps that a particular CPU must take to achieve a particular task, you can now express your intentions at a more abstract level.

For example, to find the sum of two numbers a + b = c, you might write the following.

c = a + b;

When you see code like this, even if you haven't studied programming, you can probably get an idea of what it says. However, seeing a machine language equivalent code consisting of several instructions represented in numeric code does not make it so clear.

For example, an assembly code like this,.

mov ax,1

mov bx,2

add ax,bx

mov cx,ax

mov ax,4c00h

Again a + b = c. In fact without having studied it specifically, I don't understand what it means at all.

Unfortunately, computers are the opposite for us. To a computer, high-level instructions are completely incomprehensible gibberish. That's how compilers came to be. A compiler is a program that translates a high-level language program into a detailed machine language instruction set that a computer can understand. The division of labor is such that we just need to do the high-level thinking and leave the rest to the compiler.

I recommend a learning C language / C++ learning skirt [ six six six, two nine five, four nine eight ] invitation code Lingyun, whether you are a big cow or white, is to switch or want to enter the industry can come to understand together with progress together with learning! There are dev tools in the skirt, lots of dry and technical material to share!

Commonly used compilers

Simply put, high-level languages (such as C, Java and C++) all implement code in a more abstract way, i.e. in our human minds. Again, high-level languages are easier to learn compared to machine languages, while it is easier to write programs in high-level languages with less code than in machine languages.

These are what C/C++ can do

Server development engineer, artificial intelligence, cloud computing engineer, information security (hacker anti-hacker), big data, data platform, embedded engineer, streaming media server, data control solution, image processing, audio and video development engineer, game server, distributed system, game assistance, etc.

If you can, please re-tweet and follow, thanks for your support!


Recommended>>
1、SparkHA cluster build
2、Waymo launches first public selfdriving taxi service now available to test customers
3、CinDataTable transform intoListltTgt parse
4、Redis application messaging
5、phpAdding examples of deletion and rechecking Section 29 User Avatar Change

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号