3 ms·
> For example, for a higher-level developer, a string might mean some kind of object that knows its length, auto-expands, etc. When in C a string is just an arr
by melvinroest 6y ago
> For example, for a higher-level developer, a string might mean some kind of object that knows its length, auto-expands, etc. When in C a string is just an array that it will be overflown at the very first chance. Same with other objects.
Funny, my programming knowledge in Java helped me because of the whole concept of what a reference is and a literal value. In my first Java programming class, 8 years ago, I learned that you need to have references, otherwise things will take up too much memory. My teacher took a humongous object as an example and asked "what if I need to access this at 10000 different places, but I really only need one physical copy of it?"
I was pretty upset that you had to do all of this bookkeeping and accounting. I remember being pretty vocal about that it just didn't make sense to my why one couldn't just copy stuff. I guess we all grow up at some point :)
When I saw pointers for the first time (to be fair, years later), I was thinking "ah so a pointer is basically a reference". Other people would say "a pointer is a whole lot more than just a reference, you can do pointer arithmetic with (and so on)". And I was just thinking to myself: alright, it's a reference on steroids, but the groundbreaking essential idea of the pointer is that it refers to something, just like a reference in Java.
And then I'd hit a segmentation fault and doubt my own understanding.
Learning programming felt emotionally turbulent to say the least, haha.