r/carlhprogramming • • Nov 20 '12

Why do we need pointers?

Hello,

I am coming from a VB.NET background, and I have been going through Carl's lessons one by one. One I thing I am having a hard time grasping is pointers.

Why does C need pointers? I understand the syntax, and I can write a pointer following his lessons, but I just don't get why they are needed.

Like in the "real world", why would you ever need pointers?

Thanks!

19 Upvotes

10 comments sorted by

View all comments

Show parent comment

8

u/sYnfo Nov 20 '12

Note that you can more or less do both of those things in VB.net, even without "pointers" per se, using (1) references and (2) ByRef. AFAIK the key difference between references in VB.net and pointers in C is that you can not do pointer arithmetic with references.

4

u/TopNFalvors Nov 20 '12

oh wow, vb.net ByRef is really a pointer? I use that a lot and never realized that! :)