Linux Programming Learning

Source: Internet
Author: User
Tags time and date


Linux Programming Learning

Tool article
"Public desire good things, its prerequisite." Programming is a very practical work, in your future study or work, you will often deal with the following tools, listed below to learn C language programming often used software and tools.

(i) Operating system
It is easy to learn C on UNIX or Linux systems, so please select a UNIX or Linux operating system before starting your learning journey.
Currently available to individuals for free use of UNIX or Linux systems are FreeBSD, RedHat Linux, SUSE Linux, etc., and in the installation package also provides a lot of useful tools, such as: GCC, make and so on.
If you have been using Windows and have no redundant machines to install UNIX on your side, you can use VMware to install virtual systems through VMware.

(ii) Compilation tools
Currently, most Unix or lnux systems offer CC or GCC compilers, and the simplest CC command format is as follows:
Cc-o Hello hello.c
Typing the above code in a UNIX shell environment compiles the HELLO.C program into an executable hello.

Make tools such as GNU make, System V make, and Berkeley make are the basic tools used to organize the application compilation process, but each make tool is different.
Most UNIX and Linux programs are compiled by running make. The Make tool reads a file that contains instructions (the name of this file is usually makefile or makefile, but we call it "makefile" later in this article) and performs various operations to compile the program


(iii) Debugging Tools
The simplest debugging tool: Add a print statement to your program
After you have a certain understanding of the operating mechanism of the program, you can use some tools to help you debug, of course, you have to learn the tools to be used, such as: Dbx,gdb.
There are also some memory tools to help you find memory leaks or buffer overflows, such as: MEMWATCH,YAMD, etc.

(iv) Other tools
1. VI or VIM
Unix below this editor. Mainly by a bunch of commands to edit text files, Unix programming is best familiar with and proficient in using the VI editor.
Of course, you may need an integrated coding environment or a powerful graphical editing tool in your actual work.
Provides a Chinese-language vim online brochure: http://vcd.gro.clinux.org/

2. Netterm
One of the most famous web terminal software, it can be used conveniently to connect to the host system.

3. Secure Shell
A client-side tool that supports the SSH protocol and is used in most cases to connect to a Linux system.

Book Articles
"The book is the ladder of human progress." Learn a new knowledge, of course, to choose a few books suitable for their own, here are some of my own study of C language used books:

1. "C Primer Plus"
Recommended reasons: Suitable as an introductory book and basic functions of reference. The latest version of this book is the fifth edition, which introduces the C language in detail in the ANSI C99 standard.

2. "The C programming_language"
Reason for recommendation: the father of C language works authoritative and unquestionable. Although the book publishing time is older, it seems that there is no update, but still a classic book, the online version of the book is available in English electronic download.

3. "C Expert Programming"
Recommended reasons: This book can help some experienced C programmer to become a C programming experts, the most important thing is the book fun, let you fully enjoy the joy of programming.

4. "C Defects and pitfalls"
Reason for recommendation: The knowledge revealed in the book can help you bypass the C language's own pitfalls and flaws, and reduce many common bugs in your code.

5. Advanced Programming for the UNIX environment
Recommended reason: Since the UNIX environment under C programming, you have to talk about Unix programming books. Mr. Stevens's "UNIX Environment Advanced Programming" is my best recommendation, but also my desk must (if you are interested in network programming, you can learn about Mr. Stevens's "UNIX Network Programming" two volumes, if it is not fun, you can look at the "TCP/IP detailed" three volumes).

6. The Art of computer programming
Recommended reason: The algorithm master has to work in painstaking work. The plan is to publish a five-volume book, which appears to have been published in 3 volumes. Have an interest in the algorithm can be studied.

Process Chapter
1. Learn C Grammar
Grammar learning is easy for a programming base, and even if you have not studied other programming languages before, I believe you can do it easily for 2 weeks.
It is important to note that you should not dwell too much on the details of the language, such as the problem of operator precedence and binding.

2. Learn C Standard library
The ANSI C library divides functions into different groups, each with a header file associated with it. The C language standard library is very short and concise relative to other languages, such as C++,java, but first of all focus on the following libraries:
Ctype.h: Character processing
MATH.H: Math Library
Stdio.h: Standard I/O Library
Stdlib.h: Common Tool Library
String.h: String Handling
Time.h: Time and date
If you want to know the finished ANSI C library, you can purchase related books, these books will generally detail the users of each function and some points of attention; Of course you can log in.
Http://www.dinkumware.com/manuals/?manual=compleat&page=index.html gets the ANSI C library details.

3. Difficulty in overcoming C
C Language statement:
The C statement really made me feel horrible, rather obscure, and the form of the statement was similar to the form used. For example, the following statement is probably not even familiar with the C years of programmers can be seen at a glance:
char * const * (*next) ();
So is there a good memory method or rule to figure out, as if there is no such torture. But take a look at the third chapter of C expert programming, and maybe you'll get something.
Also can only learn more practice, so-called make perfect, hope this problem do not leave a shadow on your mind.
Arrays and pointers:
The relationship between the array and the pointer, in the standard does not make very detailed provisions, and a lot of C introductory books on this issue does not give a very detailed explanation, so it will cause a lot of misunderstanding.
For this question, you can refer to the "C Defects and Traps" section 4.5 and "C Expert programming" chapter 4,9,10, I believe you have a thorough understanding of the content, will not be confused by this problem.
Pointers vs. Memory:
If you later write a larger program, you may find that the problem may be your biggest annoyance, and it may be a matter of your most time consuming debugging.
Issue with version C:
You have to be very careful with this problem, it is best not to mix the different version C features in your program, otherwise you will be confusing problems. If you must use it, you'd better know what you're doing.
There are some other difficulties in C and error prone areas, you can learn some of the previous experience. Here is a C FAQ link address, I believe in this document you need to solve most of the problems.
http://c-faq-chn.sourceforge.net/

4. UNIX Environment Programming
After studying the above, I believe that you will be able to program the UNIX environment. But you may need to know a little bit about operating system theory, so it will be easier to learn.
Unix environment Programming, you should focus on IO and process two chunks of content. UNIX environment Programming has a very detailed and in-depth description of the UNIX environment, and there are a number of practical examples in the book, but it may take months to chew.

In a solid grasp of the above content, does not mean that you have to C language learning branch has been completed, on the contrary, has just begun. Later you need to use the knowledge to solve a large number of different practical problems, in the process of continuous practice, you will deepen the understanding of C. With these basics in hand, you'll find that the other knowledge you need in the practice process will be very quickly mastered.

Method article
Programming is a very practical work, the best way to learn is to read while debugging code, the book on the example program repeatedly modified debugging run, from which to get their own experience.
In their own study or work to write some of the test procedures, to classify the preservation, in the future of the actual work of the continuous collation, the accumulation is a very good resource pool.
Sometimes, it may be thought that the examples in the book are more understandable when it comes to understanding, but the practical value is not high. So to improve your programming ability, you also need to learn other people's code, I think that the study of other people's code is to improve their actual programming ability the best and fastest way, now there are many high-value open source code on the network for you to choose to learn.
Finally, one of the problems that you have to mention is that you should never let yourself drown in the various technical details of the ocean, such as prefix + + operator problems, expression calculation priority issues, and so on.
Learn UNIX under C programming or other programming languages, our final goal is to use the computer to solve the problems of the real, so the accumulation of common problems in the daily work of the solution, and form a certain paradigm, do some refining is the most important. In the final analysis, the design and programming of what is done is the methodology, whether you are unconscious or conscious, so be sure to focus on accumulation.


Additional Information
1. For someone to ask whether an ANSI C99 standard is required, it is not necessary for the general developer, and not to say that its language is obscure, even if you can learn it from start to finish, I think there is no improvement in your programming.
2. Currently most UNIX operating systems with CC, GCC and other compilers do not seem to support all the new features of C99, but now enough new features are generally available, so there is reason to start seriously consider the use of C99 features in the new development, This is especially used where they make efficiency or sharpness change in nature (such as inline functions instead of macro replacements).
3. Programming specification Problems: generally more formal software companies will have their own set of completed programming specifications, then you adhere to the good; If you are learning by yourself, you can choose a more general specification, the best way is to see how others write code.

Linux Programming Learning

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.