• Sylvartas@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    4 days ago

    Most of the time you pass by reference for more outputs, or by const ref to avoid copying a big-ass data structure

    • DahGangalang@infosec.pub
      link
      fedilink
      arrow-up
      0
      ·
      4 days ago

      Another reason I commonly see: to change the structure / “main pointer” to a data structure (esp during freeing and cleanup).