Recently, C has been written on the Linux platform for project reasons.Program. In fact, I have not been familiar with Linux and C for a long time. In fact, I should start to learn from myself in February of this year. It is only two months now. In the past two months, the entire process has been quite difficult, from ignorance to familiarity, to getting something to write. Now let's look at it and I don't know how it was made! Therefore, I am going to start a small topic and record all the 1.1 drops I have learned. I will give a small suggestion to anyone who is just as interested in the title record.
This articleArticleDo not write any programming methods orCodeBut I have summarized some of my experiences over the past two months. Sometimes, this experience is more effective than a simple programming method or a few lines of code. If you are interested in learning to write C, your first thing is nothingAlgorithmOr the data structure is not a syntax or technique. Instead, you must have a "from top to bottom" or "from left to right" memory linked list in your mind. This linked list indicates the stack memory. If you can think about it, you 'd better add a memory linked list "from top to bottom", "from left to right", or "from a hill". This linked list indicates heap memory. Then, when you write a program, the two in your mind (or at least must have a stack and a linked list) are also writing data and reading data back and forth, so that yourC LanguageBasically, it is better than 10.
When talking about C language, the first response of people (almost everyone) with a background in computer education is: Fuck C, fuck pointer, fuck array and pointer. For three fuck programs in a row, I totally deny and give up C from my perspective. Is C Programs really so hard to write in real life? Is it really that hard to understand? In the beginning, I am also very jealous of pointers, but slowly, you will find that the pointer is just a thing like TMD, that's the case. However, the efficiency and ease of operation brought by pointers keep you away. I can say that I am attracted by the pointer of C. The exquisite pointer design is much more worthwhile than the usage methods and skills of pointers. I used to use C #. Since I started writing C, I think C is very refined. in C #, I want to express something, and the code is very slow, in C, a function is done, and the feeling of freedom is really good.
When talking about C, the second reaction is: Memory leakage. It is very easy to dynamically allocate memory, but you have to go back after the allocation is used up. As a result, this step is always forgotten, resulting in Memory leakage. The solution to memory leakage is actually very simple and effective, which will be reflected in the following content.
The program will still run in a certain environment, and this topic is basically compiled on the Linux platform, and cross-platform is not guaranteed. The first reason is that I am not good enough. Second, I personally think that writing a program is still a good version of a platform. Do I need to take the program out of the cross-platform environment and change it? This is fast, easy, and efficient, bugs will also be reduced. Why not ?! Therefore, in subsequent articles, there may be more or less introduction to the features of some Linux platforms. After all, the program I wrote is to enable him to go on the Linux platform, I don't care about other platforms for the time being, and I can't manage them! This is because my personal C experience is limited and the learning time is not long. If there is a mistake, it is not intentional. Please submit it. The individual will rectify the problem as soon as possible.
in the end, due to personal work and lazy psychology, the update time of this series of articles is unstable. Sometimes it may not be updated for a month, sometimes it is possible to update several articles a day. You can watch it, but don't remind me.