1
1
1bd_1l_Bari2017-04-11 11:13:57
Programming
1bd_1l_Bari, 2017-04-11 11:13:57

Pointers and dynamic memory in C++?

Good afternoon. Question for experienced C++ programmers. Two months ago I started learning C++ (I didn't manage to master it after 21 days). Everything went quite simply and clearly until I encountered pointers and dynamic memory. Pointers, in principle, are more or less clear: their role, their functions. But when it came to pointers to a pointer and dynamic memory allocation, dynamic arrays, there were difficulties. How often do you have to use them when developing programs in C++? Is it possible to do without them at all?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Moseychuk, 2017-04-11
@fshp

No. Pointers are everywhere, even where they are not clearly visible. For example, a container created on the stack stores data on the heap anyway. If you don’t even get it right, then nothing sensible will come of you.
Pointers in C++ programming are like addition tables in mathematics.

A
Alexander Skusnov, 2017-04-11
@AlexSku

Can be replaced with links and smart pointers.

V
Vasily Melnikov, 2017-04-11
@BacCM

Without knowledge of C++ pointers, it makes no sense. True, in the modern language you can do without them, or rather without their visible use, but for this you need to have a very good qualification and experience and, most importantly, understanding.
You can write simple programs without pointers, it will be similar to C #, in some places it is not optimal, in some places it is monstrously not optimal. Although there is a magic link icon to apply, just as an element of "it's necessary" it will be a little better.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question