C++ Pass by reference a single element array - It's factible?
arrays, c++, pointers
Solution
There is no point in making it a one element array. Just pass it in as a reference using the `&` operator. By making it a one element array you are making your code more complex, obfuscating the real purpose of the variable, and making the next developer's life much more annoying.
As for your resource use concerns, there is no resource different whatsoever. Under the hood both of them are basically just a pointer.
Problem
Quick question about passing vars by reference: What's more appropiate: 1) Using the classic pointers syntax: ``` void change(int *a) { a = 0; } ... int number = 1; change(&number); ``` 2) Or making it a single element array and passing it by reference as default: ``` void change(int a[]) { a[0] = 0; } ... int number[1] = {1}; change(number); ``` Something I thought off. Wanted to know how's the difference in resource use if using an array of one element instead of a simple variable.