C++ pointers are scary | Sololearn: Learn to code for FREE!

+12

C++ pointers are scary

Since C++ pointers can access anything on the heap, I am scared that while using them they might corrupt my other programs and destroy other IMPORTANT processes. Is there any IDE that lets me do so safely? Also, is the stack safe?

4/12/2019 7:56:39 AM

I'm a Squirrel

13 Answers

New Answer

+6

Sticking to a higher language to overcome fear of pointers is like sticking to the countryside to overcome fear of water.

+3

Just use like those famous IDEs, like VS Code, Atom and stuff

+3

Have you looked into smart pointers? https://stackoverflow.com/questions/106508/what-is-a-smart-pointer-and-when-should-i-use-one

+3

I'm A Squirrel, they can take away the problems coming with having to free the memory, forgetting to nullify, or accidentally using a dangling pointer to point to a random location. You just have to require the memory which is the simple part. So i actually think they should mitigate your problems quite a bit!

+2

That's why I learned Java alongside with C++. It has no pointers.

+2

C++ are interesting. IDEs - safe. Learn Javascript., Python & Java to get rid of your fear. 😑

+2

Asim Farheen I agree they will eventually lead you to learn lower level languages as you get to more advanced concepts.

+1

Hon Fu, yes I have, but they don't seem to solve my problem.

0

Absolutely

0

Try to return more than one value from your functions , create something like stacks and queues , or make something look like a dynamic arrays to figure out one of the power of pointer

-2

Hello

-2

خرب عمي شنهاذ