Hi everybody, i am new to c++ and wanna know why pointers are useful ? Why would i use them ? For what ?
I don't want to be rude, but at least take the time to search the forum, there are dozens of threads about pointers and reference. Or google it, you will find tons of pages related to this topic. Btw, did you know, you can find C++ lectures from Stanford on youtube?
Ok thanks !
Pointer to item == address of item in program space. A C++ reference is, under the covers, a pointer. You can pass the pointer to an object to a function, which if not specified as const, will allow the function to modify the object. This would be necessary if the function is a C function. If it is a C++ function, then it is safer to pass as a reference. Read more - this stuff is fundamental to understanding and writing good/safe C and C++ code.