What you need to know before you learn the C language

Source: Internet
Author: User

Order:

In order not to waste everyone's time, Daniel will not continue to look down, because this article is nonsense. But if you really are a pure rookie, if you are really a novice to touch the computer, if you really just learn C language even don't know what C language is, then please take 5 minutes to see it, maybe it will be helpful.

I remember my first C language class in college very clearly. That's the best lesson I've had in all my college classes. Because I love C language? Oh, at that time I even C language is a yarn do not know, where to love. The reason why I am happy, is because finally have a class, can let me this school slag can and genius equal, everybody not, want to hang branch together hang Ah. From the beginning to the end, our entire class is listening to the heavenly Book general, feel this thing is not human can learn, and that teacher, also because said a "C language is the most simple and useful language", and henceforth in our hearts.

Why this is the case, if your school is a freshman in the C language course, you will fully understand (genius please detour). When I was in high school, I didn't even know how to go to the Internet bar, the two keys of the desktop were what I didn't understand, you TMD told me C language? An English is enough to make people headache, and this adds a language, not to go to the four level.

So, in order to make it easy for everyone to understand, before I talk about C, I would like to share with you some computer things. At the very least, we need to know what the C language is, and then learn how to use it. So this part, you can not look at all, but if you are a thoroughly beginner, then join me, go to the computer world stroll.

Those things of the computer:

What is a computer? In fact, in the most straightforward words summed up, it is a bunch of electric scrap (and insulators?) Isn't that iron, titanium? Let's not worry about the details). Is the phone a computer? Is! Calculator? Is! Microwave? Is! Washing machine? Is! These are all computers. So, how do these computers work, and I would like to give you a brief account of three things:

First: binary and high and low voltage

We know that the ancient Chinese use abacus to do arithmetic, we also know that "Tai Chi Sheng Two, two Miriam born four elephant, four elephant health gossip, gossip set the murderer." I don't know what the principle is, but they all show a clear truth: "Multiple simple individuals, together, can generate thousands of different phenomena."

There are two states of the circuit, power and no power, then you can use tens of thousands of circuits to form a machine? So the computer was created. The binary is produced.

It is said that the computer was very large in the beginning. Want to use it requires a whole team of well-trained teams, what is the majority of people doing? Stand in line next to the power, listen to the instructions, 1th Power, 2nd power, 3rd power. Number 4th! Number 4th! What about number 4th? What the? Number 4th, it's diarrhea! Fuck, Project suspended.

So, please look at this computer in front of you, no matter what you do complex operation, in fact, inside it, are repeatedly repeated power and power off these two things. That's all.

Second: Display

Everyone has seen the square on the big screen, every day to play a variety of ads, if you have the opportunity to approach it carefully observed, you will find that the composition of a variety of patterns, in fact, a light bulb! Well, I don't know what a more professional term is. And it is this millions of light bulbs, repeatedly do turn off the lights, turn off the lights lights. Eventually a deceptive advertisement was formed. Well, you know what I'm going to say, yes, this screen before you, although the use of more advanced technology, but its essence, is also the truth.

Third: HDD

We know a lot of light bulbs turn the lights on and off to form a picture. So, if you remember the order in which they turn off the lights, do you remember the picture? This is a must. So, the scientists invented the hard disk, the principle is probably a surface coated with magnetic media disk, and magnetic media can help record the state of the circuit, so remember the lights of each lamp sequence. The details of our own Baidu bar, but the general principle is such. So, Guo Degang teacher's sentence is very reasonable, which sentence? "Read the world a piece and the heart uncensored."

and Computer dialog:

Talking to an American. We need to use English, so we need to use a language to talk to the computer. However, the computer this learning slag, it will only machine language (binary 0 and 1, power off), and it discussed together to learn English easy communication, it also does not agree, Ya's look for machine language. Then there is no way, we have to step back.

So in the beginning, engineers programmed to use machine language, they recorded the state of power-off to a roll of paper tape, (a hole in the power), and then let the computer read the tape above the recorded information, complete communication with the computer. (so it seems that there is a story between the program ape and the roll paper). But it is not good, and the daily use of paper on the body is also bad ah. So, they think, or ask for a translator.

At that time they decided to mark some representative machine language with characters, assuming that 01010111 represented addition, then they used + instead. But how to let the computer know + is 01010111? And this, is really the role of translation, engineers no longer use the volume of paper to write machine language, but directly in English characters instead, translation is responsible for translating these English character into machine language, and later, due to outstanding performance, engineers affectionately called it "compiler".

OK, things seem more and more obvious, man is always not satisfied with the status quo is not it. Since you can use special symbols instead of machine language, could you use natural language instead of special symbols? Then ask for a more advanced translation to translate this more advanced language. So, C language was born.

Operating system:

Zhu Yuanzhang Everyone knows it, the founding emperor of the Ming Dynasty, the peasant origin of what he likes to pro-force, such as just live in the palace when. Plant a tree, feed a fish, summoned a minister and so on himself to do. Palace so big, long time, Zhu Yuanzhang tired of impatient, to learn the former, also formed a own management team, including guards, eunuchs, maids, cooks and so on. Since the formation of the team, Zhu Yuanzhang no longer so hard, clothing mouth, and this team is like an operating system, you are Zhu Yuanzhang, issued a variety of instructions, let your team (operating system) for you to complete the operation of the Royal Palace (computer).

In fact, the computer operating system, is a management of computer hardware things, it on the internal resources of the computer unified management, and then to provide you with a certain number of interfaces, you through the interface to publish instructions to complete the operation of the computer.

You must ask, what part of the harem is 3,000? Oh, this still use to ask me, you are afraid of the E-disk is not more than 3,000.

Summarize:

The above-mentioned, some fictitious, some humble, but in the final analysis is to let all beginners understand a truth, that is, C language in the end is why. Now, as you know, it is a language that facilitates communication between humans and machines. Yes, in essence, learning C and learning English, learning Korean, learning Japanese is the same. Well, let's comb it out again. What is the process of writing your C code from your computer to the output on the screen.

(1) You turn on the computer, the computer loads the operating system data from the hard disk, the data is loaded into memory, the operating system starts, and the computer is managed.

(2) When you open Notepad (or other code-editing software), the operating system loads the Notepad program into memory from the hard disk, and Notepad starts to run

(3) You write the C language code in Notepad (suppose called test.c), after writing, click Save, this test.c saved to the hard disk

(4) You ask the translator (compiler, usually you may be clicking the Run button, but the internal principle is the same), translation of TEST.c translated into TEST.O and then the TEST.O and the operating system of the Library file association. Finally, the executable file is generated (this executable file on Linux is usually a.out)

(5) You run the A.out file, the computer looks at it, and everything here is known, so it starts to run the code you wrote.

Learning suggestions:

In fact, learning to program this matter, and there is no fixed method, as long as you feel that the right you can. But whether the genius or the fool, the same point is must be more knock code, even if it is copied, but also copied several times.

There are learning order, I am here to say that my personal learning order, not necessarily suitable for everyone, and the direction is not consistent, for reference only (computer composition principle, computer operation system, computer network, compiling principle, assembly language, C language, data structure, Linux (I just briefly learned how to use and basic commands), OC Language, iOS development)

Finish

What you need to know before you learn the C language

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.