void fun(int* array){}
int main(){
int array[]={1,2,3};
fun(&array);----->(1)//error in this line
return 0;
}
error: cannot convert â
While the address of any aggregate (this means arrays and standard-layout classes) is guaranteed to be the same as the address of the first element, the types are different, and there is no implicit conversion.
As an example why the different type is important and useful:
for( int *p = array; p < (&array)[1]; ++p )
iterates over all elements of array
, while
for( int *p = array; p < (&array[0])+1; ++p )
only executes once.