Describe the difference between passing parameters into a function by reference and by value? Indicating how this may lead to unexpected outputs.

Passing an input parameter by reference is also called pass by address, this is where the address of the variable to act on is passed to the function. This allows the function to change the value stored at that variable. Passing an input parameter by value is when a copy of the input variable is taken and manipulated by the function, but the actual data stored within the variable is not changed by the function. If you wish to edit the stored variables but use pass by value you may end up with an error as it could seem as though your function was not performing as expected when really it was simply the method used to pass variables that would be causing the error.

Answered by Morgan B. Computing tutor

1878 Views

See similar Computing A Level tutors

Related Computing A Level answers

All answers ▸

Given a graph with n nodes and m edges, every edge has a passing cost that can be negative, find the minimum distance between node 1 and every other node


Choose 3 types of malware, describe them and the ways in which they may harm a device.


Why are bit patterns often displayed in hexadecimal notation instead of binary notation?


What are the benefits of Reverse Polish Notation and what is it?


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2024

Terms & Conditions|Privacy Policy