S
S
sddvxd2017-01-04 12:49:34
Programming
sddvxd, 2017-01-04 12:49:34

What do pointers point to?

I delve into the essence of debugging programs, I got to the pointers. The book I'm reading is very professionally written. I read from some article that pointers point to the memory area in which the structure is stored, and by the byte offset you can go down to the lower fields of the structure. If I understood correctly and correctly formulated the definition for myself, then what can be considered a structure? class instance?
Let's say

class Car
{
    infoCar* examplePointer; // Указатель на структуру
}

class InfoCar
{
    int hp;
    string color;
    long idCar;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
15432, 2017-01-04
@sddvxd

The pointer is the RAM address where the class instance is located. This address stores the values ​​of all properties of this instance of the class, as well as a pointer to the table of methods and static members of the class (common for all instances).
A pointer to an ordinary int variable is just a memory address where the value of this variable is located.
The function pointer is the memory address where the function code is stored.
Well and so on

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question