Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You have got to be kidding us. But I don't really get it - what is difficult in & and * operators?

I do teach programming, and most of the time I see both the concept of pointers, and syntax is pretty understandable.

The real trouble begins when you expect students to use them to their advantage - but it really is beyond syntax.



Unfortunately I'm not. I tried learning C as my second language after VB and the syntax seemed unnecessarily complicated to me (like '->').

As a newb, you get bogged down in the details and knowing the cases for when to use &,* seems like an added complication.


See? This syntax trouble is already lesson #1 you learn from pointers: The _address_ of some value and the _value itself_.

If you have a pointer (that is, the address), then you need to prefix it with a * in order to get the value in order to do useful things. If you have a value, you need to prefix it with & in order to get the value's address in order to pass it around more efficient (at least it will be more efficient if it is some large data blob).

Did anyone ever mention addresses and values and their difference when looking at Java from a users point? Not to me, to be honest.


Pointers are easy. I thought several people in our CS program how to use them in ~2 hours. What's hard for most people is thinking abstractly between what the code looks like and what happens when you run it.

Pointers are simply the first thing that forces most coders to consider that split. But, a reasonably competent JAVA developer moving to C can pick them up in little time. The problem is reading other peoples C code that looks more like line noise than structure. But, pointers are a tiny step along that path.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: