Saturday, April 11, 2015

C Array


The name of an array is a constant pointer to the first element of the array.  We can pass an array to the function of the equivalent signature

int fn(int* const x)

int a[5] = [100, 200, 300, 400, 500];
int b
b = fn(a);

Because array name is a pointer, it can be returned by a function as such (beware of out-of-scope issue).

No comments: