---
title: "Discussion on \"pass by reference VS. pass by value: Which One Should You Use in Your Code?\" | Hashnode"
description: "Discussion on \"pass by reference VS. pass by value: Which One Should You Use in Your Code?\". Two ways to save data in programming\nWhen you put data into the variable, the programming language has 2 choices to save the data.\n\nSave data into heap memory and then keep the address of the memory in the stack memory.\n\nsave data into stack memory.\n..."
url: "https://hashnode.com/posts/pass-by-reference-vs-pass-by-value-which-one-should-you-use-in-your-code/642f8c96c6efed9248d44339"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [pass by reference VS. pass by value: Which One Should You Use in Your Code?](https://eunhanlee.hashnode.dev/pass-by-reference-vs-pass-by-value-which-one-should-you-use-in-your-code?utm_source=hashnode&utm_medium=feed)

Two ways to save data in programming When you put data into the variable, the programming language has 2 choices to save the data. Save data into heap memory and then keep the address of the memory in the stack memory. save data into stack memory. ...

Apr 7, 2023 · 3 min read · eunhanlee.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#cpp](https://hashnode.com/tag/cpp)
-   [#pass-by-value](https://hashnode.com/tag/pass-by-value)
-   [#pass-by-reference](https://hashnode.com/tag/pass-by-reference)

## Written by

[Han](https://hashnode.com/@EunHaSu)

@EunHaSu · VA, US

  
[View profile](https://hashnode.com/@EunHaSu)

Java, Android, Algorithm

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
