question on array as a pointer

if an array is effectively a pointer to the first element, then passing an array in a function must necessarily be by reference, and can never be done by value ? is this correct, thanks
arrays are passed into functions by pointer, and yes you're correct they cannot be passed by value

1
2
3
void func(int[] arr)
{
}


the syntax makes it look like you're passing in a whole array but that's just to make it look pretty, you're really passing the address of the first element
Last edited on
Topic archived. No new replies allowed.