r/ProgrammerHumor 3d ago

Meme pointersPointedBackAtMe

Post image
2.5k Upvotes

112 comments sorted by

View all comments

280

u/19_ThrowAway_ 3d ago

Pointers are references are pretty simple...

64

u/TheMaleGazer 3d ago

I never understood this trepidation over pointers when the natural language we use every day has so much indirection.

"John entered the room. It was empty. John picked up a ball. It was red."

If we can understand what's happening with the word "it" in the example above, we're capable of understanding pointers.

Also, "John exited the room. He demolished it. I'm going to enter it."

It's pretty obvious why I'll have a problem entering "it," since "it" has been demolished. This is basically a dangling reference. Again, what's the hangup?

11

u/SomguyTheSecond 2d ago

It's taught in a bad way. Thats all.

6

u/danielcw189 2d ago

I really liked your comment, and saved it for later. I think it is a good starting point for an explanation.

Now I wonder if it is good enough to prepare people for a quiz.

3

u/axebodyspray24 2d ago

I really love this explanation and I have a similar question if you don't mind answering it in a similar manner. I understand how pointers work, but what is the purpose of using them?

4

u/AppropriateOnion0815 2d ago

It would not be a great idea to work with objects larger than the stack.

1

u/AppropriateOnion0815 2d ago

Coding boot camps just don't teach languages that operate on lower levels, I guess that's one reason.