I recently learned the concept of pass-by-reference where instead of copying data into a function’s parameter, you simply give it the address of where the variable being passed is located in memory.
In C++ you have to explicitly define that you want to pass by reference instead of value. Would it not be more efficient to use pass by reference by default since you’re not duplicating data in memory potentially for no real reason?
What's the point of passing a pointer to an integer instead of passing the integer directly? You're just creating indirection and pointer-walking, which makes your code strictly worse.
Passing by value also prevents the function from having accidental side-effects of changing stuff outside it.
Passing by value allows you to save memory when passing things smaller than a pointer (like, say, an int in x86_64).
Every C/C++ programmer should learn assembly. It makes C trivial to learn, and would certainly have helped you analyze the reasoning behind stuff like this.