4 ms·
What is so difficult about the concept of a memory address? Is it the C syntax? Asking because I personally have never struggled with this.
by Koshkin 4y ago
What is so difficult about the concept of a memory address? Is it the C syntax? Asking because I personally have never struggled with this.
- andrewla 4y agoThat's the problem! I can't tell you what is difficult because it seems so incredibly obvious to me now. When I was ~12, I had a lot of trouble with it, and the only thing I remember from those times is various attempts to figure out why the compiler wouldn't let me assign a string value to an array. What the hell is an "lvalue", Mr. Compiler? Now I look at the assignment command above and I recoil in horror, but for some reason at the time it seemed very confusing to me, especially since `char *str; str = "abcd";` works so well. The different between the two (as far as intention goes) is vast in retrospect, but for some reason I had trouble with it at the time.
- rando14775 4y agoThe pointer/array confusion in C makes this way harder to understand than it has to be. The other thing is the syntax, which is too clever and too hard to parse in your head for complex expressions. Both of these things also tend to not be explained very well to beginners, probably partly due to the fact that explaining it in detail is complex and would perhaps go over the beginner's head. It's also stupid, so you'd probably have to explain how it turned out to be this complex.
- DougBTX 4y ago> Is it the C syntax? Pretty sure that this is a big factor, I’m not aware of any recent languages that put type information before and after the variable name. Nowadays there’s always a clear distinction between the variable name and the type annotation.