summaryrefslogtreecommitdiff
path: root/Passing a pointer to heap data as an argument to a function transfers its ownership.md
diff options
context:
space:
mode:
Diffstat (limited to 'Passing a pointer to heap data as an argument to a function transfers its ownership.md')
-rw-r--r--Passing a pointer to heap data as an argument to a function transfers its ownership.md1
1 files changed, 1 insertions, 0 deletions
diff --git a/Passing a pointer to heap data as an argument to a function transfers its ownership.md b/Passing a pointer to heap data as an argument to a function transfers its ownership.md
new file mode 100644
index 0000000..754f141
--- /dev/null
+++ b/Passing a pointer to heap data as an argument to a function transfers its ownership.md
@@ -0,0 +1 @@
+Passing a variable into a parameter of a function is basically an assignment. So if we pass a pointer to heap data to a function the [[Moved heap data principle]] states that ownership is passed to that function. Thus the original variable can not be used anymore, for example after the function returns. \ No newline at end of file