C Language Quick learning and Getting Started Guide

Source: Internet
Author: User
Some people think that now is the era of Java and. NET, who still need C and assembly? I don't know, Java and. NET is built on the software, is to monopolize the market and the establishment of the system, as if to dig a golden wall brilliant pit, please jump down, but also think of standing on the shoulders of giants, in fact became the frog in the pit bottom. To become a real programmer, and expect to become a master programmer, must start from the machine, from the CPU to the operating system, and then to the software system, the realm of the master is enlightened after the mirror Lingtai, software design Superb, I am the program, the program is me.

Spectator John Doe said: This is stupid also! I use the mouse to drag a few controls, is a XXX management system, you use the C language afraid of a year can not write it! Well, I would like to admit that this is already the slave of MS, other I do not understand, MFC itself is a closed architecture, from MFC to learn, you will only form a closed thinking mode, because Ms hope that many people only learn the surface of things, not to become a master, So it strongly recommends the so-called Visualization of the program development tools, there are many people are willing to go to his when, finally really lost direction. Said he could not sit the program, he can also do, but if the program is a bit more complicated, there is a problem, where the problem is not clear, anyway is not clear!

Liang Zhao Xin, Daniel, he said: "I do not understand, with the mouse how to write the program?" In my company, the master of the keyboard ring, the mouse occasionally ring, the novice is the mouse ring, the keyboard occasionally ring, their salary is not a difference of so much! "

C language is the basis of the major operating systems, Unix, Linux, Windows, the kernel is exclusively is the C language development, (some places are mixed with assembly language), you do not see WindowsAPI is the C language function interface? Unix/linux Most of the applications are C language development, Windows applications with pure API development is not much, mostly rely on some kind of applicationframework, such as the so-called VC + +, in fact, refers to vcide+c++ language +mfc ( The focus has now shifted to ATL, WTL), but the underlying software, such as Windows services, networks, drivers, or C language has been developed. Compilers for various languages, including Java virtual machines, have been developed in C language. A variety of embedded devices, such as mobile phones, PDAs are also developed in the C language.

The first one to pack and move along with you is the "canonical format". Therefore, the canonical format is the basis for getting started. What does the format of this specification include? A lot of ah, to insist on to do! Long marker name, code indentation, a pair of curly braces no more than one screen, and so on.

The second one to pack is patience, so-called 工欲善其事, its prerequisite. It is impossible to succeed without a relatively dull process. It's not just that you have to be patient in your learning process, you have to be gradual, and you're talking about another important aspect: the tuning process. Debugging is the process of writing a key aspect, if someone can write a program, cow, and is Daniel, not only Daniel, or I rode the green cow, mortal is do not Tao! Debugging is the process that every program must experience.

What do you learn from the first trick? Hit the dog stick Method! Oh

There is a great man said: "Repeated authority is the only way to mature", this is standing on the shoulders of giants, the practice of martial arts people must first learn all kinds of routines, such as evil sword, and then to the mastery, open sect genre; we learn to write programs like this, this is a shortcut to help you go farther to the shortcut.

Read, watch the book! Written in the book, is written by the predecessors decades of experience, read 10 books, it is equivalent to learn from the predecessors decades of skill, then your internal strength will quickly rise 1. : Books, of course, should be optimistic about books, only good books are rich in nutrition. To do a reading broken million, programming such as God, boring reading is very depressed, it is easy to become a fossil! Now a lot of books are using the source code to explain the problem, the source is like an animation, like a slide, the book of the moves one by one to you to see. Their own manual input this step can not be omitted, and now a lot of books have matching source code, many students or adults learn to play smart, directly copy the source of the past compile and run, HoHo, this is no effect.

TC has at least one advantage, can exercise our habit of using the combination of keys, we can exercise our use of keyboard programming habits.

Read a good book if you want to read it, or you might as well not read it.

Kernighan and Ritchie's "Thecprogramminglanguage" (Chinese translation "C programming language") is a classic classics, but the old version of a lot of content is outdated, and now the standard C language is far from, we must look at the latest version, Otherwise it's better not to look. In addition, even the most classic and authoritative books, there is no way to cover the whole, so the standing of a "C Language Reference manual" is very necessary. "C Language Reference manual" is "Creferencemanual", is the C language standard detailed description, including the vast majority of C standard library function details, is considered to be the best standard C language reference book. Incidentally, the latest C programming language was revised in accordance with the C89 standard, while the C Language Reference manual describes the C99 standard, which may be somewhat out of the way, and is recommended to be studied in accordance with C99 standards. There is also a copy of the "C and the hands", writing is also quite good, English name is "Pointersonc", especially emphasize the importance of pointers, is a characteristic of this book. But this book is not very suitable for beginners, if you have learned C language, there are some C language foundation but not very solid, then you can try this book. I believe that as long as you understand the pointer, C language is no longer mysterious.

If you have eaten a C language textbook and want to go further, there are two books you must see. The first is "Ctrapsandpitfalls" (the "C Trap and defect"), a very thin booklet, the content is very very interesting. Note that this book was written more than 20 years ago and that many of the C-language flaws mentioned have been improved, but it is not a bad thing to be able to understand some history. Then you can challenge the "expertcprogramming" ("C expert programming"), the book as its name, this book is difficult, once you read carefully and can thoroughly understand, you can confidently write "proficient in C language" on the resume.

Remember a principle, do not read the book you do not understand at present, it is a waste of life. If you do not understand, then you must be missing some essential basic knowledge. At this point, you have to carefully analyze what you need to add, and then go to the bookstore to find the books that tell the content. The basic knowledge after the completion of the back to learn, will be the real multiplier.

Second, unix/linux or Windows, this is a big problem

Different programming environments can create different thinking programmers. Most programmers in Windows rely on an integrated development environment, such as VisualStudio, and UNIX programmers love makefile and consoles. Obviously, the integrated development environment is easier to get started with, learning C on Windows, just a few basic visutalc++ toolbar buttons to start writing hello,world!, and under Unix you need some basic knowledge of console operations. Some people may think that the UNIX environment is more concise, but the power of habit is great.

So I suggest that beginners should take visualc++6.0 (not visualc++. NET) or devc++ as the primary learning environment, and do not dwell too much on the IDE's use of skills, because you will have to turn to the UNIX environment in the future. visualc++6.0 is very convenient to use, debugging is also very intuitive, but its default compiler for the C standard support is not good, and devc++ using the GCC compiler, the C99 standards are well supported. Using Incidentally, Many of the university's C language courses are still using TurboC2.0 as an experimental environment, which is quite undesirable, the reason is that TC2.0 has little support for the C standard, and the other is the TC2.0 compiled program is 16-bit, which will be very difficult to understand the 32-bit program in the future (of course, Using something like DJGPP can make TC2.0 compile 32-bit programs, but that's too complicated.

When you finish learning a C-language textbook, you must move on to the UNIX platform to continue learning, and almost all of the advanced C-language tutorials are based on UNIX platforms (such as "c Expert programming"). The process of change is painful, you need to face a variety of complex commands, completely different from the Windows platform thinking, but this pain is worthwhile. UNIX and C are symbiotic, Unix thinking and habits more in line with the C language of thinking and habits. Under UNIX, you can find countless excellent source code for you to read, you can easily see a library function of the online manual, you can see the best code style (speaking of code style, I will write a detailed article).

It boils down to a phrase: Beginner C, the recommended Windows system and integrated development environment, and when you're ready to go to the "master" direction, turn to UNIX platforms first.

Three, everything is ready, you are the East wind

The book has been selected, the environment is configured to complete, so-called ready, only owe your own efforts. Please start from the preface of the book, carefully read the materials at hand, many people read like directly from the first chapter to see, this is the wrong way. The preface is the author's general introduction to the whole book, and the author will generally tell you what foundation you need to be able to read the book smoothly, which can help you test whether your basic knowledge is already available. After reading the preface, but also to browse the table of contents, to understand the overall structure of the book, by the way to arrange a study plan.

After the example is the problem, I suggest that the beginner will do all the exercises independently.

Maybe you think it's too slow to learn. Learn to be careful not to go back, and so you learn to find yourself in front of not clear, that is really worth the candle. Generally speaking, the whole book read, you should complete thousands of lines or even tens of thousands of lines of code, whether it is copied from the book, or their own whim to write on, are continuing to learn a wealth of future. In my own example, when I read Windows core programming (I only read 3/4 of the content), in addition to the code on the transcription, but also wrote a lot of examples of their own, a total of 5574 lines (using the WC Tool under UNIX statistics), after a few days, I have forgotten Windows system programming, But just spend a few minutes flipping through the old code to see it again. The so-called good memory is inferior to bad writing, this is the truth.

READ carefully, carefully copy the source code, the independent completion of the exercise and further experiments, and finally all the code left behind, become their own experience and wealth, absolute hard, but also absolute multiplier. Of course, this approach is only suitable for learning skills that need to be proficient, and if you are not learning C, you will need to specifically analyze the situation.

In the end, there is a very, very important point not to mention the code style, which must be forced to imitate the best code style from the very beginning. Because the code style too important content too much, I will use a special article to discuss in detail, please pay attention to the "Programmer's road-about code style".

Stop here, above said is My Learning style: always have to go through some twists and turns, blind toss a few, and then there will be accidental awareness-enlightened! I have not even seen a few people have me so stupid, now understand, I always start to think about things too complex, causing the dog bite the hedgehog embarrassing situation, however unexpectedly has the unexpected harvest! But do not recommend that you imitate this style, at least when chasing a girlfriend can not be so, life is a lot of opportunities to take over the moment, lost will never find back.

Now come back, then by chance, I understand a line of code, is the print statement, at that time the excitement is deadly, and carefully looked at this to see that, suddenly see a lot of things, like in the grabbing between what to hit, immediately between clairvoyant ....

However, still that sentence destroy nothing, do not hinder. Like I now have a computer, all day in the Internet to soak in the sea, feel the fast food culture, a long time has not been quiet to think about something good.

Speaking of C, I think that any friend who has learned it has the feeling that "let me rejoice and let me worry." "The joy is that C language features are very powerful, widely used, once mastered, you can confidently say to others," I am a computer master! , and it's easy to learn other languages later. The worry is that C language is like "Shaolin martial arts" generally profound, too difficult to learn. In fact, I think that C language is not "difficult (difficult)", as long as you can clear the idea, master its essence, then self-study C language is a very easy and fun thing. Today I will talk with you about how to learn C language or to learn C language from which aspects to start.

Personally, no matter what language you learn, you should first understand the background of the language you are learning, or the history of it. C language belongs to a kind of high-level programming language, its predecessor is "ALGOL". Its founder is Brown · W. and Dennis · M. Leach. The C language comes with a lot of limitations because it can only be used on UNIX systems. However, with the progress of science and technology, the development of computer industry, C language gradually divorced from UNIX. In 1987, the American Standardization Association developed the C Language International standard, referred to as "Ansic", since then it became a widely used programming language. C language has many advantages, the main is the following four points:

Both high-level language and low-level language advantages, belong to an intermediate language.

It is a structured programming language that is well suited for structured programming.

There are a wealth of data types, operators, and functions to choose from.

Working directly with memory makes it easy and easy to modify and edit other programs and documents.

How to learn C language well? To get started as soon as possible to master the characteristics of the computer, the characteristics of the computer include:

The computer is required to handle the problem in a way that all may have to tell it.

The computer requires that the description of the program is accurate and non-ambiguous.

Computer programming is required to have a strong global and logical, there is no problem of ups and downs.

The computer requires its owner, consider the problem to be comprehensive, all possible situations and processing to tell it, the need to learn calm, the mentality of stability, the need to communicate the statement must understand the meaning of a single.

How to quickly learn C language, faster to spend the running-in period? C language of the grammatical rules of the memory understanding of course is indispensable, in addition to pay attention to the following aspects:

Balance mentality, although can not do "not with the things happy, not with their own sorrow" level, but at least not impetuous, do not rush to haste, waste.

To cultivate their own global consciousness, can not only small, but also large without outside, just do.

In strict accordance with the procedure design process design procedures, do not jump off, unrestrained, no rules are inadequate surrounding area.

Strive to improve their overall quality. Procedure is the expression form of human thought, and it is the combination of people's thinking and language of dealing with problems. You are in direct proportion to the degree to which you know the objective. If you do not understand the problem of processing, will not deal with, you can not write the program.

Learning to communicate, to communicate, to complement each other, and team work is also very important.

  • 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.