How can I understand how pointers work in C/C++, this shit is driving me mad

How can I understand how pointers work in C/C++, this shit is driving me mad.

Attached: 1643821531819.png (230x219, 10.41K)

Other urls found in this thread:

youtube.com/watch?v=0zd8eznWv4k
youtube.com/watch?v=sQCSX7vmmKY
twitter.com/SFWRedditImages

Attached: file.png (800x443, 86.97K)

it's just a memory address

Stop spamming this shit.

This is a spam thread. All of these threads asking dead simple shit are spam threads to waste your time. The people / bots posting them are trying to decrease the signal / noise ratio of this board. I don't know why but you need to stop wasting time on them.

persist with study and practice, it will click eventually

it's ez

Attached: understanding pointers for baka.png (1476x1149, 717.47K)

retard bait thread made by Any Forums nigger

Not really, I'm just genuinenly struggling.
So the 20 and 30 on the right side of the pic are still on the #2008 address, right? Also, would it have made a difference if I wrote "**ptr = &var" instead of "**ptr = &ptr"?

It really is. For example, the string "Segmentation fault (core dumped)" is just an alias for the memory address 0x0. The best way to see this is to run this program:
#include
int main(){
char *msg = 0x0;
printf("%d", *msg);
return 0;
}

And you'll get "Segmentation fault (core dumped)" printed from memory address zero.

kek, good trolling. people need to stop thinking about pointers as memory addresses. what you can do with pointers are quite restricted in C (strict aliasing, pointer arithmetics only defined within the object bound etc)

just grab any algorithm & data structure ya damn tub of lard and finish your fucking assignments.

The pinnacle of cnile intelligence

Attached: 1633609453563.jpg (1709x719, 82.78K)

There's nothing wrong with asking for help if you need it, and honestly I keep forgetting it too when I don't use C++ for a long time.

This here is a good overview
youtube.com/watch?v=0zd8eznWv4k

If you're using C++ outside if some academic bullshit where they want you to use raw pointers, prefer to use smart pointers:
youtube.com/watch?v=sQCSX7vmmKY

This pic is a bit misleading. The &var and &ptr should point to the addresses instead of the value

Thanks user

got any more pointerjaks?

there's literally no restriction; IF you know what you're doing.

No matter what people here say, raw pointers are dumb. In 99% of cases, modern garbage collectors are almost as good as doing memory management by yourself and have good algorithms to prevent overload. In any other case, smart pointers will do the trick.

I recently had to work with old MISRA C code that was full of goto end; statements to avoid the caveats that raw pointers come with. It was unreadable

Pointers are simple - it's just an index in array.

Attached: photo_2021-10-04_16-02-07.jpg (498x593, 15.22K)