Pointers and References
-
Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..
Born to win...!
-
Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..
Born to win...!
-
Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..
Born to win...!
-
Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..
Born to win...!
Wikipedia - Reference (C++)[^] References - Parashift.com[^] Reference Variable vs Pointers - student.cs[^] Please learn to use Google search, instead of being spoon fed for simple things such as this.
Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..
Born to win...!
I think both servers the same purpose. But, usually References are preferred over pointers as the reference can not be a NULL as like pointers. In some scenario pointers are the only solutions. Like the function which returns the object or NULL (specifying failure). But pointer isn't alternate solution for reference. Because you must have to make use of references while overloading an operator or providing an explicit copy constructor.
-Malli...! :rose:****
-
Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..
Born to win...!
And I think you can see www.cplusplus.com[^].
-
Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..
Born to win...!
Additional to the links from the previous posters.... Rule of thumb: Use references when ever possible, pointers when necessary.
My Webchat in Europe :java: