Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 611701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:48:46+00:00 2026-05-13T17:48:46+00:00

My teacher in c++ told me that call by reference should only be used

  • 0

My teacher in c++ told me that call by reference should only be used if I’m not going to change anything on the arrays inside the function.
I have some really big vectors that I’m passing around in my program. All the vectors will be modified inside the functions. My matrices are of sizes about [256*256][256][50]…

Is there some particular reason not to use call-by reference here?

AFAIK call by reference should be way faster and consume less memory?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:48:47+00:00Added an answer on May 13, 2026 at 5:48 pm

    My teacher in c++ told me that call by reference should only be used if I’m not going to change anything on the arrays inside the function.

    It should be used when you are not changing something inside the function or you change things and want the changes to be reflected to the original array or don’t care about the changes to be reflected in the original array.

    It shouldn’t be used if you don’t want your function to change your original array (you need to preserve the original values after the call) and the callee function changes the values of the passed argument.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A sysadmin teacher told me one day that I should learn to use make
I can't, for the life of me, remember what exactly our teacher said that
I need to write a compiler. It's homework at the univ. The teacher told
That may sound a little confusing. Basically, I have a function CCard newCard() {
I have Teacher, Student, and Parent models that all belong to User. This is
I have a Relationship table that links teachers to students Teacher Student 1 1
I am currently in an operating systems class and my teacher spent half of
Yet again, my teacher was unable to answer my question. I knew who may
Today when I was in computer organization class, teacher talked about something interesting to
A couple of weeks ago, my piano teacher and I were bouncing ideas off

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.