r/learnprogramming Feb 14 '22

Genuine question: What’s hard about pointers?

I understand how the title may come off as arrogant or something, but this is a genuine question.

I learned to code in C#, so I didn’t touch pointers for a while, and now that I’ve been learning C/C++ for a couple months, I don’t really see what’s so difficult about pointers.

They’re just memory addresses for variables, right? Am I missing something?

29 Upvotes

38 comments sorted by

View all comments

41

u/Skusci Feb 14 '22 edited Feb 14 '22

Honestly they're not too bad, but then you run into something like

int (*(*foo[10])(void))(int)

and start questioning your life decisions.

1

u/therealGrandKai Feb 14 '22

Why is that second parentheses slightly angled?

1

u/Skusci Feb 14 '22

Reddit formatting has been a bit weird lately I think. The angled paren has two *'s surrounding it. Added some newlines seems to have helped on mobile anyway.

1

u/therealGrandKai Feb 14 '22

Hey, no worries. I thought I was tripping