Many people find it difficult to learn C language and often ask me the same question: How to learn C language? I am a teacher and have developed programs for many years. Like many people who are just starting out, the first computer language I learned was C language. After these years of development, I deeply realize how important C language is to a programmer. If you don’t understand C language, it almost sounds ridiculous if you want to write low-level programs. If you don’t understand C language, you want to write Excellent and efficient program, this is simply a fantasy. Why is C language so important? First: The grammatical structure of C language is very concise and exquisite, and the programs written are also very efficient, making it easy to describe algorithms. Most programmers are willing to use C language to describe the algorithm itself, so if you want to make achievements in programming , you must learn it. Second: C language allows you to go deep into the bottom layer of the system. Which operating system do you know that is not written in C language? All windows, Unix, Linux, Mac, and os/2 are not the same inside or outside. If you don't understand C language, how can you go deep into these operating systems? Not to mention writing their kernel programs. Third: Many new languages ??are derived from C language, C++, Java, C#, J#, perl... which one is not? Once you master the C language, it can be said that you have mastered many languages. After simple learning, you can use these new languages ??to develop. This once again verifies that the C language is an important foundation for programming. Also, let me say one more thing: even if you are recruiting programmers now, the exams all test C language. If you want to join the IT industry, you must master C language. So how to learn C language? 1: If you want to do your job well, you must first sharpen your tools. Here are some essential things for learning C language: a development environment, such as turbo C 2.0, which once occupied most of the development programs in the DOS era. But in the current Windows era, using Turbo C feels inconvenient. It is very difficult to edit the program, and drag and drop is required. There is no automatic function variable sensing function, and it is inconvenient to check reference materials. It is recommended to use Visual C++. Although this thing is relatively bulky, once installed, it is very convenient to use. A learning tutorial. There are so many C language textbooks now, but I recommend everyone to use "C Language Programming" edited by Tan Haoqiang, second edition, Tsinghua University Press. This book is very suitable for beginners, and the content is also very precise. In addition, there are many software to assist learning. After all, we are now in the Window era. There are so many learning software. It is not like the old-fashioned way when we studied only by reading and doing questions. I recommend an "Integrated Learning Environment (C Language)" to everyone. The summary of knowledge points and routine explanations are very good. There is also a question bank test environment. It is said that there are thousands of questions, and there is even a trubo C under Windows. , beginners can practice programming without even installing other compilers, which is very suitable for beginners. There is also a "C language learning system" software, but it feels like it is just a question bank system. If you feel that the questions are not enough, you might as well give it a try. 2: Sunflower Collection What is the best way to learn computer language? The answer is: read the program. Yes, reading programs is the fastest and best way to get started with learning C language. Like me, when learning new J#, C# and other languages, I no longer hold a book and read line by line, but learn their routines. Of course, for beginners who have never learned any computer language, it is best to read the tutorial first. After studying each chapter, you must carefully understand all the concepts in this chapter, and then do not miss all the examples mentioned in this chapter. program, and then read the program carefully until you understand every line, then find a few programming questions, preferably similar or the same as the routine, and try to write the program you have understood. Don’t think of it as a routine for you. Once you understand it, you can write the same program. It’s absolutely not certain. If you don’t believe it, just give it a try. If you can’t write it, don’t worry. Go back and continue to study the routine. Think about yourself. Why can't you write it? Then write this program again and again until you have it. Congratulations, you are almost getting started. 3: The highest level of writing programs is to master various means of solving problems (data structures) and methods of solving problems (algorithms). Does writing low-level programs make you a master of programming? No, writing low-level programs is nothing more than mastering the structure of the hardware. Moreover, hardware and hardware are different. To write a driver for a chip, it is nothing more than mastering the various registers and their combinations of the chip, and then writing and reading values. , nothing more. This is just familiar with some io functions. So what does it take to be proficient in programming? How can one become proficient in programming? For example: there are 10 people in front of you, and you find a person named "Zhang San", what should you do? The first method: directly ask these 10 people: "Who is Zhang San?" Method 2: You ask each person "Are you Zhang San?" until the person you ask is Zhang San. The third method: Go and ask each person one by one, "Do you recognize Zhang San? Point it out to me."
Don’t underestimate this question. You said of course you would choose the first method. Yes, congratulations on your correct answer, because this method is the fastest and most efficient. However, finding the optimal method to solve the problem in programming and the means you use are not. It is an important sign that tests a programmer's programming level, and it is not easy to achieve. The problem just now is similar to that in data structures and algorithms: Map data structure, exhaustive search and binary search. Therefore, mastering data structures and some common algorithms is the inevitable way to reach the top. Finally, I recommend Yan Weimin's "Data Structure" from Tsinghua University Press. I hope everyone who wants to become a programming master will read this book. [Editor: Zhao Jinjun] 2. Language learning methods. Let’s talk about my learning methods and give some ideas! No matter how you learn, you can learn it eventually. But others learned it in one month, but it took you 100 years to learn it. Isn’t it too late? :) Therefore, learning still requires methods. If you study correctly, you will get twice the result with half the effort; if you study incorrectly, you will get twice the result with half the effort. What is the shortcut to learning C language? My answer is to read books. What is written in the book is written by predecessors with decades of experience. Reading ten books is equivalent to absorbing decades of skills from predecessors, and your internal strength will also increase rapidly by a Jiazi. :) Of course, you must read good books. Only good books are nutritious. Suppose you spend a day reading a crappy book, and although the knowledge introduced in the book is brand new to you, due to improper organization or insufficient depth in the book, you gain very little nutrition and are still confused. It's better to study it by yourself in a day. This kind of book is not worth reading. What good books should I read to learn C language? I think we should first read a solid foundation of basic books, such as the four books introduced in "Four Books and Five Classics of C Language". (Although many of these books are out of print, I believe electronic versions are also very beneficial. Besides, if you really want to read them, I believe you will have a way to get them.) You will read these books in a short time Finished (for example, one or two months), it depends on your foundation and understanding. What books should I read next? I might as well list a few more. Bjarne Stroustrup's "C++ Programming Language" (theC++ Programming Language) must be read. The definitions of some basic concepts of C in this book are more comprehensive and detailed than any other C language book I have seen; Bjarne Stroustrup's "The Design and Evolution of C++" and David R. Hanson's "C Interfaces and Implaementations Techniques for Creating Reusable Software" must be You should read that these two books describe how to use C to implement exception handling, type encapsulation and extension, and other advanced technologies that are often used in large projects. For other books, you should read about operating systems, compilation principles, algorithms, and patterns. Reading through thousands of volumes, coding is like a god. All in all, it is just like what is said in "Zhuan": "Those who are born knowing are the best; those who know by learning are the second; those who learn when they are stuck are the second." We cannot always learn because of difficulties, but we must do it The soldiers and horses have not moved, but the food and grass go first. Reading is the guide for learning. Books can introduce concepts clearly one by one, but books cannot introduce you to the details of applications one by one, because applications are always complicated and changeable. Therefore, if we want to be familiar with the tricks and understand how to use them as described in the book, we must read more source codes. When Linus answers questions to others, he often says Read the fucking source code; Hou Jie also mentioned in his article that "before the source code, there are no secrets." This is the master's motto. The source code is like an animation or a slide show, showing you the moves in the book one by one. It can be said that most of the experience of experts comes from code. The source code is the same as the book. You should look at the good ones and not the bad ones. Here, I recommend looking at Linux kernel source code and Linux tcp/ip source code. Both sets of codes are open source and readily available. In addition, you can also cooperate with Andrew S. Tanenbaum's "Operating Systems: Design and Implementation" (Operating Systems: Design and Implementation), Mao Decao and Hu Ximing's "Linux Kernel Source Code Scenario Analysis", Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman Co-authored "Linux Device Driver, 3e", W.Richard Stevens "TCP/IP Detailed Explanation (3 Parts)" (TCP/IP Illustracted), W.Richard Stevens "Advanced Programming in UNIX Environment" (Advanced Programming in the UNIX Environment, the new version adds content about the Linux kernel) and other books, which is very convenient.
Of course, the program cannot be seen, it must be written. When I was in high school, I insisted on writing programs for 6 hours a day. I repeated exercises on "Data Structure", permutation and combination, and graph theory N times. Although it has been five or six years now and many of the contents have long been forgotten, it has cultivated my strong coding and debugging abilities, which is still of great help to my work until now.