Is there a difference between &array[0] and &array when passed to a C Function. This array is a void* array which currently takes integer as data.
Added the
This won't compile, you are using a void *
and try to get the first element of it. But what size does it have? The compiler doesn't know. Using int *
may compile, if you are not trying something like this:
int main (void) {
int *arr = malloc( 10 );
arr = &arr[0]; // this is ok
arr = &arr; // wrong data type
}
&array
returns an int **
, &array[0]
returns int *
. These are different data types.