• Sylvartas@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 month 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
      2
      ·
      1 month ago

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