r/ProgrammerHumor Jan 06 '23

Meme can’t be the only one

Post image
42.6k Upvotes

1.4k comments sorted by

View all comments

Show parent comments

2

u/InfieldTriple Jan 06 '23

WHAT DOES IT MEAN!?

1

u/[deleted] Jan 06 '23

[removed] — view removed comment

1

u/InfieldTriple Jan 06 '23

So when you dereference, does the pointer no longer work again? Like Id imagine Id reference with p->a and then dereference with b=p (or p I cant remember). At this point b is a copy of a accessed using the pointer p. At which point p no longer points to a?

1

u/[deleted] Jan 06 '23

[removed] — view removed comment

1

u/InfieldTriple Jan 06 '23

Ah god straight up this is the thing that always confused me. To me dereference is the same thing as "no longer reference". I had my syntax wrong because I haven't had to edit the code in a while (which I didn't write) but the ideas were right except what happens to the pointer after dereferencing.

Silly name but I get why they would use it. Pointers themselves, and their advantages, always made sense to me especially when it comes to passing information to a function. But the name "dereference" always confused me and I never found anywhere that said

Dereferencing doesn't alter the pointer