Post #3215984
2026-06-09 07:03 UTC
The & operator references the value.
int i;
int* p = &i;
In C++, the & at the function argument makes it a reference type (safe pointer).
void someFunction(int& refVal) {
[...]
}
Replies (1)
-
@Flames5123@sh.itjust.works 2026-06-09 08:04
As someone who likes working with higher level languages, I never understood the pass by reference or even referencing different pointers. It never stuck out to me as useful in what I want software to do. It’s too close to hardware.