What does adding (1, a + 2) to functions mean if a is an array?

I looked at this piece of code, and I'm not sure if adding means that "a" is an array.

int main(int argc, char* argv[]){
int a[] = {1, 3, 5, 7, 9};

function(1, a+2);
return 0;}

Suppose a function is already created.

+4
source share
1 answer

In an expression (except when used with sizeof or &), the name of the array is a pointer to the first element of the array. Thus, it a+2is “pointer arithmetic” on that pointer and leads to a pointer to an element with offset 2. It is equivalent &a[2].

+8
source

Source: https://habr.com/ru/post/1524212/


All Articles