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
My teacher told us that there is a default class in Java for binary
When I learned C, teacher told me all day long: Don't use goto, that's
I have an assignment that my teacher has told us to use this in
So my teacher told me to make a string that makes whatever I type
I made an application, that uses Swing and Hibernate facilities and my teacher told
The teacher never explained us anything about unix and bash. He told us something
Days ago, my teacher told me it was possible to check if a given
My teacher asked me to do a program using execlp that will do the
That may sound a little confusing. Basically, I have a function CCard newCard() {

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.