Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Pointers and References

Pointers and References

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jhony george
    wrote on last edited by
    #1

    Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..

    Born to win...!

    _ P R M H 6 Replies Last reply
    0
    • J Jhony george

      Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..

      Born to win...!

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      This[^] should give you some idea.

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      1 Reply Last reply
      0
      • J Jhony george

        Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..

        Born to win...!

        P Offline
        P Offline
        Paresh Chitte
        wrote on last edited by
        #3

        Please refer here[^]. Regards, Paresh.

        1 Reply Last reply
        0
        • J Jhony george

          Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..

          Born to win...!

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • J Jhony george

            Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..

            Born to win...!

            M Offline
            M Offline
            Malli_S
            wrote on last edited by
            #5

            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:****

            1 Reply Last reply
            0
            • J Jhony george

              Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..

              Born to win...!

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              And I think you can see www.cplusplus.com[^].

              1 Reply Last reply
              0
              • J Jhony george

                Hai, i am having a doubt.. When to use pointers and references..? Please tell me the scenarios... Thanks, Mani..

                Born to win...!

                M Offline
                M Offline
                Moak
                wrote on last edited by
                #7

                Additional to the links from the previous posters.... Rule of thumb: Use references when ever possible, pointers when necessary.

                My Webchat in Europe :java:

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups