The pointers in C are so hard to learn, what should I do?

Updated on technology 2024-03-12
7 answers
  1. Anonymous users2024-02-06

    The pointer can be said to be a major feature of C, many people accidentally understand it, in fact, you can understand what the pointer is by comparing the visual method. When the data storage in the C language does not have a pointer to intervene, it is directly operated, just like if you go to a building to find someone, the security guards bring people directly to you, and C accesses the data as well, but sometimes you just don't know the name of this variable, that is, you don't know what the person's name is, can you still find the data or person, that is, you can use a pointer in C to achieve it, which is equivalent to you don't know what the person's name is, but you know that he lives in that room (let's assume that a room lives in a person), The security guard can still bring people to you, and the same goes for C, if you point out that the data is in that location, the CPU can also find the data for you, the same way. And what's the benefit of this.,It's going to talk about arrays.,You have a bunch of numbers stored in a continuous memory unit.,Similar to your group of friends living in that building.,And it's living next to each other.,You have to call them out to play.,Just like you want to take out the data and use it.,Then I would have shaken the registration word one by one to the security guard.,Say which person and that person and so on to help me find it.,C can also be achieved through this method.,But it's obviously too troublesome.,If you know the room number where the first person lives.,And then for example, there are 10 people, So you just need to say help me call the next number to the number of people (referring to the continuous room number they live in), oh, it's easier for the security guard to do, because the name of the security guard may not be known, but the room number must be known, the same is true in c, you don't need to call these data one by one, directly know the address of their first data, and then count down one by one to say that the data in that location can be called by me, in fact, you give a variable, the CPU still has to find that number through the address, It's like if you tell the security guard the name of that person, he still has to find out which room he lives in.

    I hope you can use the pointer well.

  2. Anonymous users2024-02-05

    First of all, the basic concepts should be thoroughly understood. What are addresses, pointers, and more. Then it is necessary to understand the operation of the pointer, what kinds of operations can be performed on the pointer data, and what the actual meaning of each operation is.

    Finally, it is necessary to read more example problems and do more exercises to deepen your understanding of pointers and their ability to use them flexibly.

  3. Anonymous users2024-02-04

    There is nothing difficult about pointers, but the difficulty of pointers lies in their application, but many people first find it difficult to understand pointers when they come into contact with them.

    First of all, in the C language, the variables in a program are next to each other in memory, and each variable has an address, so this address is also next to each other, and in general, it is more convenient for programmers to use hexadecimal to represent the address of the pointer.

    We can get the address of a variable by (& variable), and we can assign this address to a variable, and of course we can pass this address to a subfunction.

    When a subfunction gets this address, it can output the address of this variable directly with ("%f", the variable assigned to the address of a variable), and the great thing is that we can get the value of this variable by (*variable with the address of a variable).

    #include

    int zizhihanshu(int *f)

    int main()

    Secondly, you can use the address of the variable d and the variable ad to subtract it with a hexadecimal computer, and you will find that the result obtained is 4 or (-4), that is, an integer variable occupies 4 bytes in memory, and it also confirms that a variable that is assigned next to ** is also next to the address in memory.

    character, take the address.

    to reflect the value on the address.

    The pointer in C is actually very easy to understand, and the key is how to use the pointer flexibly in actual operation later. If you don't make good progress when you learn the pointer, you can search the Internet for some knowledge about memory, which can help you understand.

  4. Anonymous users2024-02-03

    The pointer is really hard to follow.

    Bai solution. The pointer has two bodies.

    Second, the pointer contains a certain content. What makes pointers special is that their contents hold the addresses of other variables.

    The above two points can be better illustrated by examples 7-7 in the book.

    For example, define the pointer variable intp1. intp1=&a means that the information stored in intp1 is the address of a.

    *intp1 indicates the value stored by the memory unit of the address saved by intp1, which is actually the value of a.

    So, you give *intp1=&a;It's a bad way to write it. We can assume that we can give another variable b. Let *intp1=b=&a, then.

    b &a, indicating the address of a saved by b, so that b is a pointer. *intp1=b, then intp1 points to the memory cell b. So, intp1 can be seen as a pointer to a.

    The above example is more winding, think about it slowly, and you will understand.

  5. Anonymous users2024-02-02

    Pointers are one of the essences of the C language, and most of them use pointers in the C language, and they use pointers to carry out the content of the address.

    The operation is a very important method, of course, it is important, however, importance and difficulty are a pair of irrelevant variables, just as, some knowledge is very important, it is very simple, some knowledge is difficult, it is not important, this kind of problem is not directly related, in short, as long as it is hard to learn, no matter how difficult the knowledge can be broken, give you a C Q group, welcome to join the learning 67546170

  6. Anonymous users2024-02-01

    Because you won't, it won't be hard.

  7. Anonymous users2024-01-31

    You can think of the pointer as a water glass, and the thing the pointer points to as the water in the glass.

Related questions
6 answers2024-03-12

The p of both is a pointer.

p=&t, change the content that p points to to the address of t, and p=&t is the address that changes the pointer to t. >>>More

26 answers2024-03-12

1. Find something you like to do 2. Think about what you want to be 3. Concentrate on your work 4. Study more and exercise more 5. Go out and see more of other people's lives.

12 answers2024-03-12

You can gently rub both sides of your cheeks and jaw, and rub it often, such as rubbing it after eating, to relieve the increase in masseter muscles caused by eating.

24 answers2024-03-12

It is recommended to go to the internal medicine department of the hospital on an empty stomach for a check-up, do a gastroscopy, learn more, and treat the symptoms**, usually eat on time, mainly light, millet porridge and pasta are nourishing the stomach.

20 answers2024-03-12

So do you like him? Do you have a deep relationship? You're only 23 years old, you're still young, you can work hard for a few more years, and when you reach a certain job position, you will find that there are actually a lot of boys you can choose from, and girls don't have to decide their life so early. >>>More