"If the public wants to do good things, they must sharpen their tools first". Programming is a very practical work. In the future study or work, you will often deal with the following tools. The following lists the software and tools that are often used in learning C language programming.
1, operating system
It is very convenient to learn C under UNIX or Linux system, so please choose a UNIX or Linux operating system before you start your learning journey. At present, UNIX or Linux systems available to individuals for free use include FreeBSD, RedHat Linux, SUSE Linux and so on. And the installation package provides many practical tools, such as gcc, make, etc.
If you have been using Windows and have no spare machine to install UNIX, you can use VMware to install a virtual system through VMware.
2. Compiler tools
At present, most Unix or Lnux systems provide cc or GCC compilers. The simplest CC command format is as follows:
cc -o hello hello.c
Typing the above code in unix shell environment will compile the hello.c program into the executable file hello.
3. Making tools
For example, GNU make, System V make and Berkeley make are all basic tools used to organize the compilation process of applications, but each make tool is different.
Most UNIX and Linux programs are compiled by running make.
The Make tool will read a file containing instructions (the name of this file is usually Makefile or makefile, but we will call it "makefile" later) and perform various operations to compile the program.
4. Debugging tools
The simplest debugging tool: add print statements to the 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 how to use these tools, such as dbx and gdb.
There are also some memory tools that can help you find some problems such as memory leakage or buffer overflow, such as: memwatch, yamd and so on.
5. Other tools
1)vi or vim
Text editor under Unix. Editing text files mainly depends on a bunch of commands. It is best to be familiar with and skilled in using vi editor when learning Unix programming.
Of course, in practical work, you may need an integrated coding environment or a powerful graphic editing tool.
Provide details of the Chinese version of vim online manual: /manual...ampANSI C library.
3. overcome the difficulty of C.
1)C language statement:
The sentences in C language really make me feel horrible and obscure, and the form of the sentences is similar to that used. For example, I'm afraid even many programmers who have been familiar with C for many years can't see it at a glance:
char * const *(* next)();
So is there a good memory method or rule to find out? I don't think so. If there is, it's not that torturous. However, you can look at the third chapter of "C Expert Programming" and maybe you will get something.
You can only learn more and practice more. Practice makes perfect. I hope this question won't leave a shadow in your heart.
2) Arrays and pointers:
The standard does not specify the relationship between array and pointer in detail, and many C introductory books do not give a detailed explanation on this issue, so it will cause many misunderstandings.
This problem can be referred to Section 4.5 of C Defects and Traps and Chapters 4, 9, 10 of C Expert Programming. I believe you will understand the content thoroughly and will not be confused by this question in the future.
3) Pointer and memory:
If you write a large-scale program in the future, you may find that this problem may be your biggest worry, and it may be the thing that you spend the most time debugging.
4) Problems with the C version:
You must be very careful about this problem. You'd better not mix the features of different versions of C in your program, otherwise it will bring you very confusing problems. If you must use it, you'd better know what you are doing.
C there are some other difficulties and mistakes, and we can learn from some previous experience. Below is a link address of c FAQ. I believe this document contains the solutions to most of the problems you need.
/
4. Programming in 4.UNIX environment
After learning the above, I believe you can program in unix environment. But you may need to know a little bit about operating system theory, so it will be easier to learn.
Programming in Unix environment should focus on IO and process.
Advanced Programming in Unix Environment has a very detailed and in-depth discussion on programming in Unix environment. There are a lot of practical sample programs in the book, but it may take several months to chew them well.
Having a solid grasp of the above contents does not mean that your branch of C language learning has been completed, on the contrary, it has just begun. In the future, you need to use what you have learned to solve many different practical problems. In the process of continuous practice, you will further deepen your understanding of C. With the above foundation, you will find that other knowledge you need in practice will be mastered soon.