+ 1
How do i declare arrays in a function parameter?
I tried to declar an array in the function parameter this way : arr[3]= {1,1,1,}, but it didn't work, why?
1 Odpowiedź
0
You can't define an array with a default argument in c++. The argument arr[3] is actually just a pointer to memory.
Also, the 3 in the argument is actually just a hint to the programmer to the expected size as well. And the calling code can pass an array of any size to the function.