Current location - Education and Training Encyclopedia - Educational Knowledge - I want to teach myself C++. Where should I start?
I want to teach myself C++. Where should I start?
Many C language beginners may encounter many problems. The biggest problem is that they have no experience and don't know how to improve. According to my years of experience and the results of interviews with others, the problem of many people is that they are not skilled in grammar and have no experience.

In fact, there are not many standard C language grammars, but many C compilers have added many new features to meet the needs of practical work, so it is not necessary to master them.

Variables in 1, C language. Many people know variables, as long as what they have learned is very clear. But I don't know the allocation space of variables in actual operation, such as char bytes, int 4 bytes and short 2 bytes. There will be some differences under different operating systems. In addition, the pointer is usually 4 bytes.

Similarly, the type of variables is closely related to the allocation space. To grasp the essence of (forced) type conversion, I think you must know that, by the way, the access space is different. What's the value?

Address alignment, align keyword, used to access memory faster. Like large and small terminals, this is related to memory, and of course it is also related to cpu.

2, pointer. This is the most troublesome problem, and it is also a problem that is often not well understood. In fact, a pointer is an address. For convenience and space saving, we define a pointer to the address we want to visit, and then operate. Pointers are also typed, usually the type we define is the same as the variable we want to access.

3, function. Function is a function code, which operates on variables, and the variables correspond to the objects you want to access, and are finally written into the registers of the computer. Therefore, it is necessary to have a better understanding of the registers (functions) of the computing chip. For example, how to use some registers of intel8086 series depends on relevant specifications. The most basic function is to give the address you want to visit and then read and write the value of that address.

Thank you for the printf () function. This function can tell you a lot, such as sizeof(long). Do you know the value?

4. Process. A very important point is the idea and process. In fact, reading a specification and reading a specification is very simple. The key is how to write the function marked on spec into code. This requires thinking, which is the most basic.

In fact, it is very simple. Just find the right address and write the function (spec) you want to the address.

5. memory. All devices except cpu can be absent, but memory can't be absent. From registers to hard disks. Understanding memory is very important. Actually, it's nothing important. It is a place to store data and code. The cpu will get instructions and data from memory. Therefore, to understand the memory, understand the basic structure, design principle, if possible, understand some simple timing diagrams and schematic diagrams. The most basic ones are PN segment, cell memory cell, daisy chain and so on.

In addition, we should also understand the common file systems, such as fat, ext2, cdfs, ntfs and so on. This helps to understand how to manage memory. The functions of reading, writing, opening and closing the file system are all necessary.

Memory is a special kind of memory. It is usually only used at runtime to get better performance. There is a concept in memory, which is actually called address remapping in operating system, because the address in external memory may be different from that in memory. This requires remapping the address. You can go back and look at the operating system textbook.

In addition, functions such as malloc free for memory allocation should also be mastered.

6. Guide. There is only one sentence, put the code you want in a specific place, and then the boot program will copy your code into memory and remap it to start running your system.