Talking about C language and how to learn C language

2010-07-09  来源:本站原创  分类:CPP  人气:319 

Cloud winds recently wrote a blog " C Language Past and Present . " As a long-term use of C language development network game server programmers, clouds the wind is reason to write such a text, but still feel not enough to talk about depth, C language is not in the status of the industry how to use the description of some boundless.

Comparing the system here would like to talk about individual C ways of understanding language learning. Were in accordance with the books, test environment set up, network resources are introduced, hoping to write more complete and comprehensive number, to want to learn C language, a valuable reference for a friend.

Why learn C language?

Why study the use of C language? Why learn a great age than themselves programming language?

How do I learn programming language in the previous blog post in that, choose a programming language, "Why do the study" this purpose is the most important purpose is not clear no law good. This is why a lot of friends at the university required students to C language was not studied to understand the reasons for that. Because the purpose of study is not clear, of course, no incentive to learn. Another reason is the C language is the language of a very practical project, it is not from an Institute of a University College, but a real need to generate from the project, along with the rise of Unix and popular, simple semantics clear, powerful and not bloated, but points are concise and simple, it is essential for daily life and travel and work to good friend.

C language than C + + is one of the advantages of the principle of least surprise, one 12 is two, will not produce some strange additional private product. Using C + + to be a case, such a function prototype void PassWithClassValue (COneClass clsParam1), a little understanding of C + + friends will know, if you do not realize COneClass copy constructor, the compiler will kindly help you achieve one, and in calling this function PassWithClassValue time secretly copy constructor is called a provisional object as a parameter, for some circumstances, such as the preparation of the operating system must optimize the performance of such scenarios, these self-righteous things are very evil thing.

C language itself only provides the necessary language features, other more complex functions such as document processing, mathematical calculations, etc. are provided to library functions, or Lian malloc, free of this "must have" feature, is the way to the standard library functions provided, rather than as C-cores. Well-known in the great all-inclusive "K & R" at the beginning of the reference, for in fact can be done while, but for you can write more concise words, for the C language for is not necessary. Beside the point as to say that in other programming languages Lua can be inherited in C-simple design philosophy, and even continue this almost necessary keywords have been refused to join the maillist and wiki in Lua have mentioned continue in this problem, Lua Lua language defenders that continue for it is not necessary, do not consider adding the follow-up version of the keyword. This simple philosophy has to C language portability, portability, good company, also makes a lot of embedded systems still use the C programming language as the main working language.

Java language has a slogan: "write once, run everywhere" is cross-platform, this gimmick. Actually C language almost from the early beginning of "write once, compile everywhere" in the ANSI in 1989 after the unification of the C language standard (called C89), if a particular platform to achieve the C89 compiler integrity standards and your code does not use some special expansion (GCC and Microsoft have their own compiler specific extensions), then the code will be able to compile, and then realize what operating system-related library, C language is very simple transplantation things. Lua can be used as an example, Lua itself is full compliance with the C89 standard, do not use any specific extensions, which also ensures a C language compiler platform, can be compiled with Lua. Can compile and run C language hardware platform from A discharged to Z, is really a very interesting thing.

C language is a relatively rare application of an extremely broad field of language. Operating system such as the preparation of this highly difficult problem, only the C + +, assembly language can do. C language to write server-side software such as Apache, Nginx, or write GUI programs such as GTK. The first version of most programming languages through the C language, using the previously mentioned "write once, compile everywhere", the largest of these programming language to ensure portability. In the Web development field, C language of the application of relatively small, it is also a choice of results, Web developers need to use PHP, Ruby, Python way of dynamic languages, you can quickly modify to Express, you can best meet Yong Hu constantly changing demand, this is C language weaknesses. If the programming language applications to the management software from hardware, Web program to be a very rough from the bottom of the array, C language is more suitable for areas near the bottom part of the hardware, but more emphasis on the emerging language of senior management or Web development that kinds of areas of relatively close to the end user. Popular hybrid development model is the use of C language code or background part of the underlying high-performance server code, the use of dynamic languages such as Python to do front-end development, give full play to the advantages of their respective forces.

The shortcomings mentioned in C language, it is often the lack of this or that characteristic, such as was proposed to include GC, was proposed to include parallel or concurrent support of someone that does not have a fairly complete C + + exception similar strategy. Some of these features can be achieved through the introduction of third-party libraries, but the C language's design philosophy in fact determined that it does not like C + + as "very strong." Even if some people hope Yinru features will still certain people like certain people do not like the Qing Xing, now the feature is C language application in the field is already good enough, other features can be through a specific program language Shixian, and by C API and C language programs to interact. Any craftsman using only one tool can not complete his work, combining different tools to complete the task faster and better.

That C API, and marginally brief, we know the api Yehao windows operating system, Linux system api Ye Hao, or would like to Ruby, Python extension modules written, C language form of the function definition is the only choice . C language is like a middle layer, or glue, different programming language if they want to function modules mixed use, C language is the best option.

Put so much on the benefits of C language, then learn C language is suitable to see your own judgments, for example, to conduct an embedded project, or the need for server-side development, or to write a performance-related components, etc, C language is more useful choice. Also you can use in C + +, the process of intentional way of thinking using the C language, to learn C language clear and simple and neat design ideas, design level of the programming will be greatly improved.

C language learning

In the previous alluded to a more systematic learning of a new way of programming languages, C language learning can also follow a similar order: reading books, read the code, write and debug practical procedures, participate in online discussions of advanced topics.

Start learning a language is usually read reference books. I recommend a few of the great classic books, carefully read the full repeated several times, "the chance to read a hundred times since its meaning is." Select the advantage of C language learning, these books cover essentially complete all aspects of C language programming in the field, unlike C + +, as a pile of books or even read some confused, there is still so difficult to understand as a trap.

1, reference books

In the watercress, a book list above, we can directly reference

In the following brief comment about, read the order listed in the order of the best light.

"The C Programming Language"

Talking about C language and how to learn C language

If you just want to buy a book to learn C language, just buy that this is enough. If you have enough funds, I suggest you to buy some of this, the office, at home are placed one to hand, can be looking through. With three words to describe it is: Classic! Classic! Classic! Only this thin little book over 200 pages covering every aspect of C language, unprecedented and no one will follow, for any kind words are not enough to describe it.

"The C Programming Language" (later known as K & R) which contains a simple parser, how malloc contains, contains a complete operating system directory browsing program, high availability of these procedures, can be said If any one language can learn their own hands to achieve the above functions independently, basically you can be a beginning. K & R book which each segment contains well worth exploring the software development engineering practice, if not a certain development experience, in fact, is not apparent in the icebergs below the content, such as at the beginning of a chapter on the proposed to write the complete code of this approach to teaching, while those in the book or the C-trap problem where possible, have referred to, but because of space constraints, it was very simple, very hard to click on the read. I was reading this book a complete word for word, hope to make some notes, write a few blog to share.

"C Programming Language (2nd Edition version)"

This is the Chinese translation of K & R, you can start to see a Chinese translation, the original English version and then read it again, only to learn English, they can experience the kind of simple text and beautiful style.

"C traps and defects"

"C Programming experts"

These two books is to learn and use C language's friends must-two books, such as "C programming expert," devotes 23 chapters detail the array and pointers in C language the difference between the two book K & R to some extent as a way to skip the place in detail to add, highly recommended.

"C Language Reference Manual"

This is the last one you'd better buy a home is highly recommended as an essential desk reference book. Slightly in front of a few books or short, or focus on a specific topic, do not search for when they encounter problems. This is the "C Language Reference Manual" can be seen as a C language programming, "Xinhua Dictionary", a comprehensive and authoritative. Which also covers the content of C99, followed by the times.

The following books can be used as cross-reference, but also very valuable, but also suggest that you have bought the books as a friend, long time, and fresh, like I recommend these books or amazon in douban score very high on , and repeatedly reprinted.

"C and the pointer"

The importance of pointer, learned C language (or C + +) friends all know that this book has even overstating the pointer to an equal status with the C language, is actually introduced from the beginning, as a teaching reference books are also possible.

"C Standard Library"

This book is devoted to the C language standard library to achieve, such as malloc algorithm, using standard C language, how to write? strlen this function should be achieved? Although many of the code book and the real difference between the number of C standard library (due to the standard library to consider performance optimization, and many functions have some specific trick), but definitely worth considering.

"You must know the 495 C language"

This book is actually printed version of the C-FAQ, C-FAQ FAQ in various programming languages can be described as first-class quality. If you want to apply or recruit C-Related programmer, this book must be reference.

"Linux C Programming one-stop learning"

This book is based on a specific operating system Linux to introduce C programming language, can be used as a textbook or computer-related professional entry-reference, the book is the only one inside its own original programming books were very rare. Almost all the book content online directly to the public, be modified for the views of readers, which is very rare in an open manner. Is recommended you buy.

Learning C language, must not only read, the book which should be hands-on exercises to complete the project needs (such as the preparation of a directory browser) and exercises for each chapter title. This needs to laboratory conditions, the following simple to do some different operating system introduced.

2, hands-on experimental environment set up

Not investigated, do not know the school to learn C language is not still follow the Transplantation and Hemopurification teachers use TurboC2.0 programming, or the combination, if so, would be too bad, and they quickly set aside.

The following introduces the integration of different operating system platform programming environment for beginners as well as based on my personal preferences do not recommend you use the vim command line program, and directly on the IDE.

Windows systems recommend you use Code:: blocks of this software. The software comes with the biggest advantage is based on the GCC mingw and GDB, as long as download about 70M package, you can complete support for C + +, C language programming. Features (such as debugging) is also very powerful, version of the update is also faster. Note the name of a mingw download selected files, such as the latest version of codeblocks-10.05mingw-setup.exe (version may vary.)


Talking about C language and how to learn C language

If you need to do the development of Windows operating system, you can download the Visual C + + 2010 Express.

Talking about C language and how to learn C language

Because Code:: Blocks does not include Windows programming header files (actually is because there is no Windows SDK), can not write Windows operating system-related interface applications or services such procedures. The VC + + Express comes with the headers and programming libraries, although the function a little shabby, but basic enough to use for practice.


For students of computer science friends, it is recommended you use the Linux operating system, or a little more detail is to use Xubuntu as a desktop operating system, using Netbeans and the GCC this combination (of course, can choose to Code:: Blocks). Under the Xubuntu can apt-get install build-essential procedures of this command to install gcc, has been compiled in Terminal C language program, but for convenience, we can choose Netbeans for C + + support package can be in the Netbeans site Download.

Talking about C language and how to learn C language


If you use Apple Mac, XCode is no doubt an excellent programming choice, XCode Apple Developer web site can be downloaded for free in the IPhone SDK also includes XCode.

Talking about C language and how to learn C language


If you do not have appropriate programming environment, also need to test some simple code, you can use services, online preparation to run the code.

Talking about C language and how to learn C language

Another suggestion is to apply for a account, in practice can save your code, you do not carry around a U disk.

3, network resources

If you want to use the 10 minutes time understanding the ins and outs of C language, past lives, this Wikipedia page 28programming_language% 29 is the best option.

Can be seen from Wikipedia, C language designed in 1972 by Dennis Ritchie's imperative, structured programming language paradigm. Type of weak static type, need to explicitly define. The latest international standards for the C99. Designed mainly by the B, ALGOL68, assembly language, PL / I, FORTRAN effect, C language has also affected a large number of programming languages, such as C + +, Objective-C, C #, Java, Go, PHP, Python, etc. (personal feel is strongly influenced by C PHP, basically C programming-based programmer, PHP is very easy to get started, and in addition to PHP's OO part).

In the Wikipedia article describes in great length that the C language of the missing features, such as object-oriented, multi-threaded, GC, exception handling, etc., of course, some find fault, if you need these features, can use other programming languages . Another presentation focused on the "undefined behavior", some of us take for granted the results, in fact, the standard C language does not clearly defined, assuming that these acts should be, when the program or use another compiler compiler to run different versions of are likely to produce a bug.

Then Wikipedia article about the usefulness of the C language, programming language must be recognized despite the hundreds of now, can they be called "system level" of very few new languages can be called only Go. Large-scale software projects now use C language is completely unlikely, but the core structures can use C, C + + development tools relatively high price, C language-related free supporting software development is very rich, such as splint, valgrind, many After the core library is also very stable long-term use.

As the C language wide variety of platforms and compiler support is relatively mature and reliable, many programming languages choose C language as an intermediate layer, such as Glasgow Haskell compiler is doing.

One can find a lot of C programming language where relevant information is "Delicious Bookmarks", by searching a specific keyword (C + programming) can find a lot to tap the resources of programming

You can also refer to in C language classification aging performance compared to almost delicious bookmarks, but the classification and comparison of systems should be easier to find.

Programmers are often lazy, "used", "copy doctrine" is also very popular and effective, when on a certain function or keyword is not very understanding when to see how others use, would be very instructive . Here are some commonly used code search site, the most commonly used is google's codesearch: , different conditions and by the regular expression search for specific keywords. Also can refer to Wikipedia, a " sample of the article with the C language "category, which is also very well written code. You can also search for related items at In the previous blog article, I also introduced a Web site called the Rosetta code this site can be found in different programming languages for a solution to the problem, for learning more is very convenient.

Learning to program also needs a large number of famous classical code reading, and learning to read Chinese classics in English needs a lot of sense, C language programming quality projects that are "colorful flags flying, sea of people", individual recommendations can see Lua, Sqlite, Nginx code of these projects, small amount of code, and code quality is relatively high. Also take a look at Linux kernel code, though there have been many books can help interpret. Read the code on how well we can refer to the "Code Reading" book.

Read several books, wrote some code, but also a little and read other people's code, you should use the C language to do real work on problems they encountered, so that C language to truly become your Swiss army knife. Only if you frequently use C language programming, often thinking about how to design an elegant and efficient through the C system in order to gain a deeper understanding of C language design philosophy.

Also to involved answering questions, browse other people's questions to gain knowledge, such as this -default language on the introduction of a C char type on a small trap.

C language learning, there are some difficulties need to pay more attention, such as the pointer and the array of differences, how to interpret the complex type definition, the proper use of preprocessing preprocessor and macro definitions. In fact, these elements are repeatedly mentioned in the previous books, if the learning step by step down, should not be a problem.

When the C language to learn about time, you can also learn a dynamic language, such as Lua or Python, try to mix in actual work projects a dynamic language and C language, one plus one power play just two, but is 2 (joking about, ha ha).

Have any questions, please message.


Some useful C-language network resources:

Organization for Standardization ISO JTC1/SC22/WG14 C language home page, where you can find the document ISO C:

"The Development of the C Language" of Dennis Ritchie, very classic papers.

"C Language Panorama," the contents of this website is comprehensive:

Dan Saks's column in Programming Pointer , which the article is very deep, well worth reading. It is also a C language resource summary page. confusion C language code contest, very famous. Another C language programming contest, mainly for the hackers.

comp.lang.c and c.moderated two discussion groups recommend subscriptions, representing the largest C-related programming Internet Forum:

Here on the C language bit manipulation of the various collected many times in the interview questions often. ~ seander / bithacks.html

Taiwan used to C Daren Jserv blog, suggest that you subscribe: ~ jserv /

Some deserve attention and study C language-related items:

TinyCC, many of the items was used as dynamic compilation C language compiler engine:

GCC standard library implementation:

Glib is supporting the underlying GTK programming library, with the C standard library is not the same, in the C language object-oriented mechanism is implemented:

dietlibc introduced in the previous blog article, C standard library to another realization:

Some C language programming tool software can be used to help you improve the code quality:

PMD can be used to detect duplicate code

static analysis of projects llvm

C programming language programming specification standards: ~ ellard/CS50-96/programming-style.html

cert this document in Chinese translated version of the domestic: https: / / C + Secure + Coding + Standard

C language programming books and tutorials: that this was a very detailed, you can see it as similar to the Transplantation and Hemopurification version of the textbook. recommended that the clouds the wind has been quite in-depth introduction to the C99 standard, in-depth details of when to read. circulated on the Internet of a book in Chinese, "write optimization, efficient, error-free to code", and some English photocopy another version of "Programming the essence." of Cong Wang is very hard geek, read from two sample chapters, contains a considerable amount of content.

"C Language depth anatomy" in Baidu this library or google search that you can read some reference to sex.

"C standard and the achievement" of the new Yao Yan, his "depth exploration of C, C + +" be more in-depth books on the year, unfortunately out of print. This book can also be found in the library to Baidu. This book is also quite worth reading.

Liang Ge Ge C Language Learning Notes

C and C + + compatibility problem 2B% 2B

Another document on the C and C + + standards compliance issues:

"C Elements of Style"

"Linux Security Programming"

"C Craft" electronic version of the ~ blynn / c /

"The function pointer tutorials" function pointer tutorials.

C language programming and Unix system calls, would like to use C programming in Unix or Linux, you may visit.

Optimizing C, C + + code

Illustrated description of C language pointer

Another paper describes a C language optimized article ~ cedb / local_copies / lee.html

A C language teaching ppt

Some C programming language under Unix-related article ~ choo / lupg / tutorials / index.html

Unix, how to establish static and dynamic C-library ~ choo / lupg / tutorials / libraries / unix-c-libraries.html

How to use GDB ~ choo / lupg / Tutorials / Debugging / Debugging-with-gdb.html

Some C language programming skills ~ ctips /

Advanced C programming, advanced C language programming, you can raise the level, very helpful

C language question and answer, these questions can also be used to interview

  • Talking about C language and how to learn C language 2010-07-09

    Cloud winds recently wrote a blog " C Language Past and Present . " As a long-term use of C language development network game server programmers, clouds the wind is reason to write such a text, but still feel not enough to talk about depth, C la

  • ─ ─ the way programmers to learn C language and proficiency in C language 2010-04-18

    ─ ─ the way programmers to learn C language and proficiency in C language ─ ─ the way programmers to learn C language to learn C language is not an overnight thing, but it does not take decades to master. What is the minimum price to learn and master

  • Linux set to learn the language bg fg Shell started in text mode 2010-12-16

    1. Temporary shell language export LANG = "en_US.UTF-8" 2.lynx Suddenly want to do other things would also like to come back Ctrl + z to suspend, bg put back do other, + fg back 3.Ubuntu the grub like to upgrade, and now / boot /

  • Read books to learn c language 2011-05-08

    C language should be recorded in learning how to walk, editor of the newspaper from the computer a new Tutorial Chan Deng: c language programming, c programming language Advanced: c language FAQ Advanced: expert c programming, high-quality c / c + +

  • Linux Shell set to learn the language bg fg started in text mode 2010-12-16

    1 temporary shell language export LANG = "en_US.UTF-8" 2.lynx Suddenly want to go back to do other things Ctrl + z to suspend, bg to put the background do something else, + fg back 3.Ubuntu the grub like to upgrade, and now / boot

  • linux set system language and end-users in the garbled language linux 2010-12-22

    Modify the end user currently logged on the language will only take effect on and off the terminal is changed once the failure to re-set the next logon. Login: Enter the command vi / etc/sysconfig/i18n enter i can edit the (in command mode) (If the g

  • linux redhat 9 .. 0 set the system language and end-users in the garbled language linux 2010-12-22

    Modify the end user currently logged on the language will only take effect on and off the terminal is changed once the failure to re-set the next logon. redhat 9.0 system: Login: Enter the command vi / etc/sysconfig/i18n enter i can edit the (in comm

  • C Language Introduction: generous read pointer 2010-06-10

    Pointer is the C language is widely used as a data type. The use of pointer programming style is one of the main C language. Pointer variable can be expressed using various data structures; can be very easy to use arrays and strings; and to the same

  • Specialization is the only way out - <<out of the software factory>> Book 2009-06-25 Previously seen in online <<out of the software factory>> the series yesterday, finally bought a book at one go Qualcomm read is indeed a rare book. This book is the most important value of the real word,

  • Understanding of the database paradigm 2010-11-07

    Database design, database paradigm is essential knowledge, no understanding of the paradigm, it is impossible to design efficient, elegant databases. Maybe even the wrong database. And want to understand and grasp the paradigm are not so easy. Genera

  • Easy to understand the database schema [transfer] 2010-12-15

    Paradigm to understand the database system is short-lived data is transferred from the eternal: Database design, database paradigm is essential knowledge, no understanding of the para

  • Transfer the difference between SQL Server and MySQL 2011-07-03

    1 The fundamental difference is that they follow the basic principles of both the basic principles is the main difference between them: open vs conservative. SQL Server narrow, conservative storage engine with MySQL server scalability and open storag

  • Essential to learn the basics of C language 2010-02-04

    Chapter computers and data storage Section I understand the computer Very strange thing, and now the C language teaching, one up is variable, expression, and does not mention the computer theory and in fact, the C language as language, mathematics to

  • Learn Java road: no detours, that is a shortcut 2009-04-23

    Mentoring counseling at ChinaITLAB, the author found that the questions most frequently asked is "How to Learn Programming? Java how to study?." Similar to many of the questions answered, they will be feeling tired, it sprouted a mind to write t

  • Learn java learn so 2009-05-15

    Introduction of software development is a road full of thorns and challenges on the road, the road is full of hope. Java is also studying the case, there is no short cut. Dream like "Dragon" was not in the same cliff Virtual bamboo sobering and

  • To learn from a friend of some worth studying J2EE open source project (change) 2008-10-12

    Editor: to learn from a friend a number of J2EE open-source projects to be studied, Wuxi, Jiangsu Miao Xiao-dong This article written in my study of J2SE, J2EE, after nearly three years. The first 3 years, I studied the J2SE's Swing, Applet, Net, RMI

  • J2EE to learn some of the open-source projects to be studied 2010-03-21

    Reprinted: This article written in my study of J2SE, J2EE, after nearly three years. The first 3 years, I studied the J2SE's Swing, Applet, Net, RMI, Collections, IO, JNI ... ... study the J2EE's JDBC, Sevl

  • J2EE is worth studying to learn some of the open source project (a good thing to switch to) 2010-03-30

    This article was written in my research J2SE, J2EE, after nearly three years. 3 years ago I studied the J2SE's Swing, Applet, Net, RMI, Collections, IO, JNI ... ... of the J2EE, JDBC, Sevlet, JSP, JNDI ... .. I soon found that these seem to be too su

  • Java language thoughts 2010-03-31

    We know that computer from the hardware point of view is used to process the data, and for some input, the output of the other side, the main data processing process, is the data exchange, in a single Zhuji On , an opening of the main yes Cunchu equi

  • Really want to learn something [Abstract] 2010-04-01

    Learn the language and framework is not leading technology, key technology and language framework should be independent, and is independent of age, to long-term in-depth study, and it is what the core enterprise applications, I have summarized below