3 ms·
int arr[4]; foo(arr); We can look at this code like it passes an array by reference, but how to pass `arr` by value?
by ordu 11mo ago
int arr[4];
foo(arr);
We can look at this code like it passes an array by reference, but how to pass `arr` by value?
- uecker 11mo agoYou can pass it by value when putting it into a struct. You can also pass a pointer to the array instead of letting it decay. void foo(int (*arr)[4]); int arr[4]; foo(&arr);