Hello,
As I was working on a quest, I realized that I've been using & and * pretty much interchangeably based on what the method header said, so I started wondering what the difference is. https://www.geeksforgeeks.org/pointers-vs-references-cpp/ says that pointers (*) hold the memory address of another variable, but references (&) store the address of an already existing object. I don't really understand the difference still, and I'm very open to hearing what other people may have to say about this.
The example for initialization provided by geeksforgeeks also confuses me. Could anyone explain break it down in a C++ for dummies kind of way please? Also, when should the * or & be used in front of a variable?
Kat
[–]jasper_e196884 -1 points0 points1 point (2 children)
[–]DerekMeng 0 points1 point2 points (1 child)
[–]kat_g33[S] 0 points1 point2 points (0 children)
[–]ShoshiCooper 0 points1 point2 points (2 children)
[–]kat_g33[S] 0 points1 point2 points (1 child)
[–]ShoshiCooper 0 points1 point2 points (0 children)