+ 3

When I pass an array to a function,Is it passed by value or passed by reference?

I’m confused.When creating a function using an array as a parameter, there’s no “&” before the array, which means “pass by reference” However, the function acts as if it were passed by reference.

2nd Feb 2018, 1:37 AM
cchuan
cchuan - avatar
6 odpowiedzi
+ 3
They turn implicitly into pointers, their size is unknown when passed to a function and they don't match with the stl container design so that they're lacking consistency. And if you make them 2d, it's even worse.
2nd Feb 2018, 5:50 AM
Timon Paßlick
+ 1
Do you use the array class or low level bad practice C arrays?
2nd Feb 2018, 5:31 AM
Timon Paßlick
0
C++
2nd Feb 2018, 1:47 AM
cchuan
cchuan - avatar