Alex Rivera | Logout

standard conversions: Array-to-pointer conversion

Asked 2010-11-19T09:25:22.230
9

This is the point from ISO :Standard Conversions:Array-to-pointer conversion: $4.2.1

An lvalue or rvalue of type “array of N T” or “array of unknown bound of T” can be converted to an rvalue of type “pointer to T.” The result is a pointer to the first element of the array.

Can any one explain this, if possible with an example program.

I seen these links already, but i am unable to understand:

Array and Rvalue

I think I may have come up with an example of rvalue of array type

Edit
Report

1 Answer

2
int a[6];
int *b = a;

Pointer b points to the a[0], i.e. contains the address of the element a[0].

answered 2010-11-19T09:31:16.067

Your Answer