I'm struggling with pointers
Genuine question: What’s hard about pointers?
What do people find difficult about C pointers?
Hi. My undergraduate program used C++ and later on used C. In graduate school, I used mostly Java. As a graduate instructor and now a professor, I've taught courses in C++, Java, and Python.
Personally, I don't like the wording of your question. It conveys the idea that C pointers are intuitive.
Regardless of the language I am teaching, this is the first assignment:
Prompt the user to enter their name at the keyboard. Print on the screen "Hello, " followed by the user's name.
I estimate about 5-10% of a freshman class drops after this assignment. They can't do it. Programming is already so complicated that a simple 1 prompt echo program is over their heads. We haven't even discussed data manipulation at this point.
The concept of a location of memory referencing another location in memory is so abstract that it prevents people from progressing. Why on earth would I ever want to referencing a memory location indirectly when we're capable of solving every problem without it? The students throw their hands up in disgust and walk away. Sure, there exists some optimizations that dramatically speed up the program, but shouldn't the compiler do this work for me? I just want to pass my array to that function. I don't care how it happens as long it's the same on the inside of the function.
The students believe that the computer should make their lives easier, not harder. The pointer is the antithesis of this belief.
More on reddit.com