Passing Methods

Values can be passed to a function through two methods.

  • Pass by value: Creates a copy of the variable being passed. Any change to the copy is not reflected in the original.

  • Pass by reference: Creates an alias of the variable being passed. Alias is not a new variable but instead a new name referring to the same memory location as that of the variable being passed. Any change is reflected in the original

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy