Sounds like you're confusing references and pointers. References are similar to pointers, but they will always point to the same object and can't be re-assigned to point somewhere else. The & operator is overloaded. If you place it after a type, it means "this is a reference". If you place it before a variable, it means "take the address of".
Oh! O_o i didn't actually knew this! Thanks a lot!
Still, I agree with you, C++ is a horrible place to start learning. There's a lot of unfriendly hurdles you have to jump as a beginner and other languages have much lower barriers to entry. Preferably something with a nice visual feedback loop. A totally non-technical friend of mine has learned a lot about programming from using Unity (and C#), seems like a nice place to start.
yes, I mean, just take me for an example right now.. I was learning C++ and C myself and I still didn't know what you just showed me. I'm studying informatics and and they didn't even show me this o_O they keep using pointers for everything...
I agree with Unity, it's a great start for game programming, and I also agree with Python which Alberth suggested for any kind of general programming rly. Python seems really intuitive in a lot of ways
As IGTHORN pointed out, a reference and a pointer are slightly different. The semantic difference is inside the function (say "f" in my example), you treat the reference asif it is a normal integer (ie "x--" instead of (*x)--; ). Also, you cannot have a reference to NULL (or nullptr, in c++11).
yes, thanks to both of you
I'm glad to learn new things and you two really helped ^_^
Having reference in the language is good for learning, but it kills options for the programmer. The usual trick c/c++ of exporting data to the caller through a pointer fails to work if you need to export an object instead of a mere integer value or so (since you cannot change what a reference points to).
I miss that option dearly in Java
I made a whole engine in C++ using openGL with pointers X_x.. it was a crazy experience full of not understanding and rage XD
I really like how C# treats everything as a reference and it just kind of magically works exactly the way you want it to... Even tho it's a Microsoft product and it has really limited capabilities with cross-platform management, I think it's really easy to use and learn. Even the fact that you can use "var" instead of "int" or "string" or so is a great thing for beginners until they learn how datatypes work.
ofc I really like Java too! I learned Abstract classes and Interfaces in Java!! yay~ xD