summaryrefslogtreecommitdiff
path: root/Passing a pointer to heap data as an argument to a function transfers its ownership.md
blob: 754f141e78d3f4ef5612f323d8777906d0202906 (plain)
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.