Current location - Training Enrollment Network - Mathematics courses - What do you need to learn before learning C language?
What do you need to learn before learning C language?
Basic words need nothing. In-depth study needs English mainly for reading foreign books and code notes. Knowledge of data structures and operating systems is also required. Of course, if you want to write an efficient code, you need knowledge of discrete mathematics and computer algorithms. \x0d\ Programmer's Road-How to learn and master C language \x0d\ Programmer's Road-How to learn C language \x0d\ Learning C language is not something that can be mastered overnight, not in ten years. How to learn and master C language at the least cost is the theme of this paper. Please note that even the "minimum cost" is by no means a shortcut, but it means getting the most in the shortest time and going through a hard process. \x0d\ 1。 Read a good book, or you might as well not read it. The first problem faced by all beginners is: how to choose teaching materials. A good beginning is half the battle, and choosing an excellent textbook is the key factor to get twice the result with half the effort. Unfortunately, schools usually assign you a poor C language textbook. Fortunately, you can choose again. \x0d\ Tan Haoqiang, a famous professor, published a book Programming in C language, which is said to have a circulation of over 4 million copies. As far as I know, many schools will recommend this book as a C language textbook. Although there is only one word difference between my name (Tan Haoyu) and the professor, I am extremely determined to hack his books. This book is not written for students majoring in computer science, but for students of other majors who need to take the computer grade examination. The main shortcomings of this book are: the sample program is very unprofessional and can't teach the thinking mode that programming should master; The program style is quite bad, which will develop the bad habit of scribbling code; \ x0d \ kernigan and Ritchie's The C ProgrammingLanguage (translated from Chinese into "C Programming Language") is a classic, but many contents of the old version are out of date, which is far from the current standard C language. Be sure to read the latest version, or you might as well not read it. In addition, even the most classic and authoritative books can't cover everything, so it is necessary to keep a C language reference manual at hand. The C language reference manual is CReferenceManual, which is a detailed description of C language standards, including most details of C standard library functions, and can be regarded as the best reference book for standard C language. By the way, the latest C programming language is revised according to the C89 standard, and the C language reference manual describes the C99 standard. There may be some discrepancies, so it is recommended to study according to the C99 standard. There is also a book, C and the Pointer, which is also quite well written. The English name is "Pointers onC", with special emphasis on the importance of pointers, which is a feature of this book. However, this book is not suitable for beginners. If you have studied C language and have some C language foundation but not very solid, you can try this book. I believe that as long as you understand the pointer, C language will no longer be mysterious. \x0d\ If you have finished a C language textbook and want to go further, there are two books you must read. The first book is C Traps andPitfalls, a very thin booklet with very interesting contents. It should be noted that this book was written more than 20 years ago, and many defects of C language mentioned in it have been improved, but it is not a bad thing to know some history. Then you can challenge expert programming. As the name implies, this book is quite difficult. Once you read it carefully and understand it thoroughly, you can safely write "proficient in C language" on your resume. \x0d\ Remember a principle, don't read books you don't understand at present, it's a waste of life. If you don't understand, you must be missing some necessary basic knowledge. At this point, you should carefully analyze what you need to add, and then go to the bookstore to find books about these contents. Only by making up the basic knowledge and coming back to study can we really get twice the result with half the effort. \x0d\ Second, whether Unix/Linux or Windows is a big problem \x0d\ Different programming environments will produce programmers with different thinking. Windows programmers mostly rely on integrated development environment, such as VisualStudio, while Unix programmers prefer Makefile and console. Obviously, the integrated development environment is easier to use. To learn C language on Windows, you only need to press a few basic visual c++ toolbar buttons to start writing Hello. \x0d\ world! Under Unix, you need some basic knowledge of console operation. Some people may think that the Unix environment is simpler, but habits are very powerful. Everyone is familiar with the basic operation of Windows. It seems a bit uneconomical to install a Unix system specifically for learning C language. \x0d\ For a novice who only knows the basic operation of Windows and doesn't even know what DOS is, it is most important to do something interesting and meaningful as soon as possible. Writing a small program in C language is far more interesting than learning commands such as \x0d\ ls and cat. Besides, in order to focus on the C language itself, we have to temporarily ignore some things, such as the process of compiling links, the writing method of Makefile and so on. \x0d\ Therefore, it is recommended that beginners take Visual C++ 6.0 (not Visual C++). NET) or DevC++ as the main learning environment, and never be too entangled in the use skills of IDE, because you will definitely turn to Unix environment in the future. Visual C++6.0 is easy to use and intuitive to debug, but its default compiler does not support C standard well, while DevC++ uses gcc compiler to support C99 standard well. By the way, many universities are still using Turbo C2.0 as the experimental environment for C language courses, which is quite undesirable. One of the reasons is that TC2.0 has little support for the C standard, and the second is that the program compiled by TC2.0 is 16 bits, which will cause great trouble for understanding 32-bit programs in the future (of course, it is possible for TC 2.0 to compile 32-bit programs with something like djgpp, but that is too much. \x0d\ After learning a textbook in C language, you must turn to Unix platform to continue your study. Almost all advanced courses of C language are based on Unix platform (such as C expert programming). The process of transformation is painful, and it needs to face all kinds of complicated commands, which is completely different from the thinking mode of Windows platform, but the pain is worth it. Both Unix and C were born in * * *, and the thinking mode and habits of Unix are more in line with C language. Under Unix, you can find countless excellent source codes for you to read at will, you can easily consult the online manual of a library function, and you can also see that the best code style \x0d\ can be summed up in one sentence: C language beginners, it is recommended to use Windows system and integrated development environment. When preparing for the "master" direction, please switch to Unix platform first. \x0d\ III. Everything is ready, that is, Dongfeng \x0d\ book has been selected and the environment configuration has been completed. As the saying goes, everything is ready, only your own efforts are needed. Please read the textbook carefully from the preface of the book. Many people like to read directly from the first chapter, which is wrong. The preface is the author's general introduction to the book. The author will generally tell you what foundation you need to finish reading this book smoothly, which can help you check whether you have basic knowledge. After reading the preface, you need to browse the catalogue, understand the overall structure of the book, and arrange a study plan for yourself by the way. \x0d\ When learning C language, you must pay attention to every detail. The sample code in the book must have been typed by yourself, and the output of compilation and execution is consistent with that in the book, so you can think that you have finished learning an example. If it doesn't match, be sure to find out the reason carefully. Besides the examples in the book, I have to "create" some examples. For example, when learning operator priority, I can write several identical expressions and put brackets in different positions to see what different behaviors are, such as *p++ and (*p)++, or a = b == c, (a = b) == c and a = = (b = =). The examples in the book you copied, the modified examples and the examples you created should be carefully classified and saved, and a short note should be written in the source code to explain the intention of this example. \x0d\ Examples are followed by exercises. Beginners are advised to complete all exercises independently, and then compare the codes of the answers to see what are the shortcomings of their own codes, and then try to modify their own codes. Many people don't pay attention to exercises, which is a big mistake, because the author usually explains some important truths in exercises, rather than simply testing the previous knowledge. \x0d\ may think that learning is too slow, but it is not. You don't have to go back if you study hard. Later, when I learned it, I found that I didn't figure it out before. That's really not worth the candle. Generally speaking, to read a complete book, whether it is copied from the book intact or written on a whim, you have to complete thousands or even tens of thousands of lines of code, which is a fortune for continuing learning in the future. Take myself as an example. When reading Windows Core Programming (only 3/4 of the content was read), in addition to copying the code in the book, I also wrote many examples. A * * * has 5574 lines (wc tool statistics under unix). After many days, I can't remember the system programming of Windows for a long time, but I will know it again as long as I spend a few minutes digging out the previous code. It is for this reason that a good memory is not as good as a bad writing. \x0d\ Read carefully, copy the source code carefully, complete the exercises independently and do further experiments, and finally leave all the codes as your own experience and wealth. It is definitely hard work and get twice the result with half the effort. Of course, this method is only suitable for learning the skills that need to be mastered. If you don't learn C language, you should analyze the specific situation.