C language that thing-how to learn C language from zero?

Source: Internet
Author: User

The core of this article is to discuss how to really learn C language, rather than discuss how to get high scores in C language test. Of course, really learn the C language, take high points is not so difficult.

C language is a compulsory course for many college students, especially in science and engineering, which is the most serious subject. How to learn C language well? Here are a few points to my opinion.

Lay the groundwork.

The basis for any thing learning is very important, no foundation is certainly not easy to learn, encountered problems can not solve, and then found that the lack of a lot of foundation, will feel impossible. C Language Domestic use more is Rectification "C program Design", I recommend is C language founder involved in the preparation of "The C programming Language", Chinese name "C programming language."

Sometimes someone asks a question, explaining to him that he doesn't understand. I asked him, do you know what a variable is and what is an expression? The other party said he didn't know. This is where the foundation lacks too much performance. This kind of situation can only take a good reading to fill the foundation.

Of course, the basic knowledge is seriously deficient and cannot be blamed entirely on students.

Because C is often a freshman, many people are unable to adapt to the transition from high school to college. High school teachers forced to learn, 1.1 of the trouble to instill knowledge, and the university, the teachers have their own things, responsible teachers are occasionally take some time to focus on questions. So a lot of people suddenly changed. This is also a serious problem of education, it can not be very good to cultivate students ' ability to learn independently.

Many people do not have access to programming, the first study is very difficult to accept very normal. A lot of things may not understand, why do you want to do so? Why is printf able to output Hello world? The reason why printf can output a string, its principle in-depth research is more complicated, not to learn programming people are not understand.

So beginners, do not ask why, first of all, according to what others say, to the language gradually familiar with, to learn enough in depth, there is the basis to explore the deep-rooted principles, and even natural understanding of a lot of things, namely the so-called mastery. To put it simple, the beginner C language relies on the use of printf, while the principle of printf relies on in-depth C language knowledge, interdependent things, only to find a suitable entry point, 1.1 points of learning.

Not afraid of English

When programming, the variable name is used in English instead of pinyin, the specific discussion, can refer to the following:

Thought: Don't be afraid of English-the role and importance of English Http://www.hainter.com/english

The formation of good habits

Many beginners, there is no concept of software design norms, and even some teachers do not stress these problems, or students do not listen carefully, and this is precisely important. In the future work if engaged in software aspects of the work, the company will also have requirements for software design specifications.

The Software Design specification includes: Naming style, code style, annotation style, project document management and so on.

Naming styles include variable names, function names, and so on, first of all in English instead of Chinese, which has already been said; Unification is important, such as the first letter case, the words are underlined or capitalized, such as Lcd_display,lcd_display, Printinfomation and so on.

Reference naming Style (module name _ function):

Many people do not know the importance of code style when they learn programming, or even know what the code style is. The so-called code style, you can simply understand the layout of the program code, in the appropriate place should be indented, space, curly braces to be in accordance with the specified format. If you have a problem with your code and need someone else's help, the code layout is confusing, and the master must not bother to show you. It is like writing a composition without punctuation, even if you let the writer show you that there is a problem, they certainly do not want to see.

If you have the correct indentation, many problems such as missing braces do not occur at all.

As for the specific style of the code, such as when to wrap, where to add parentheses, there is no uniform specification. Refer to the discussion in the book "C + + Primer":

There is an endless debate about what is the correct format for C or C + + programs, and we believe that there is no single right style, but consistency is valuable. When choosing a code style, consider improving readability to make it easy to understand. Once you have chosen a style, you should use it consistently.

C + + code style in C + + Primer

In addition to the code style, the annotation style is also necessary to note, here do not elaborate.

Reference annotation Style:

Project file management, for beginners programming, small programs generally only a few files, not too many problems.

The importance of standard writing procedures

Reduce code errors and facilitate learning communication

Code confusion, others can not understand, time is long, I also can not understand

Implement code reuse, greatly improve programming efficiency

A good style is necessary when you complete a large project.

Multi-person development program, easy to cooperate

The work of the company requires strict code style.

Developing a good code style is an important process for writing high-quality programs

Writing beautiful code is an art

......

Of course, the above-mentioned style is demanding too strict, for our usual learning programming, there is no need to always be so standardized, but at least to do, can make people look more clear and comfortable, basic code style or to have a guarantee.

Serious

Earnest is also quite important. According to observation, the great God, genius, and other successful people, in his field, is generally very serious. The reason why China's technology is not good, there is an important factor is the lack of serious sense of doing things. Since childhood due to environmental factors, homework just to complete the task, formed a not serious habit. I hope that every college student in China, at least in the things they want to learn seriously enough, so as to be worthy of "college students" this name. A passage from the science net is worth our thinking:

"The gap between Japan and the toilet" http://www.hainter.com/china-japan-difference

More Practice

To learn the C language well, the most important thing is to practise more. The C language courses offered by the school will basically have a machine class, so be sure to seize these opportunities to practice programming. If you have the time and conditions, you can also be in the computer room or on their own computers to do more practical practice.

The wisdom of self-study and questioning

When you learn a problem, you have to think about it as much as possible, and then think about it by looking up books and information on the Web, and then you can't solve it, think about it, ask someone else, and ask for wisdom. For details, refer to:

The wisdom of self-study & questioning--How to break the difficulties in learning? "Http://www.hainter.com/solve-problem

C Program If the problem needs to ask questions, it is recommended to do the following points, will greatly increase the probability of being answered:

At least a basic code style, such as a reasonable indentation;

The purpose of the description procedure;

If something goes wrong, describe what went wrong and what the error was. If it is a compile-time syntax error, the compiler error messages posted out, if the execution result is not correct, the incorrect execution of the result is how much to say clearly. Because the person who is looking may not be able to use the computer to give you the program again to try again, even if the great God is not a robot, the code is not a glance can understand.

For a slightly more complex program, it is best to give a few test cases, that is, when you enter 1, 2, 3, the correct result should be how much.

The first self-starting personal site, reproduced please indicate the source: http://www.hainter.com/c-prog-language

C language that thing-how to learn C language from zero?

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.