Well, pointers are a big thing in C++, I understand them for the most part, but I'm lost on one thing:
Can you pass a pointer adress?
If I'm not mistaken, that should return a's adress right? But then, how are pointers saved to memory if they have an adress that is exactly the same? That would confuse the computer. The only logical way I can see pointers working is:Code:int a; int *b; b=a; cout << &b;
b ends up 1, a ends up 2. So am I correct in thinking that pointers are merely duplicates of a number, and, when changes, change both the "pointer" value and the actual value?Code:int a=0; int *b; b=a; //Copy the contents of a to b's adress. b++; //Add one to b, and add one to a. a=2; //Make a equal 2.
Or, am I off with this theory?