Translation of C function pointer.

Jesse Phillips jessekphillips+D at gmail.com
Fri Sep 17 12:06:03 PDT 2010


Jonathan M Davis Wrote:

> On Friday, September 17, 2010 10:43:12 Ali Çehreli wrote:
> >
> > int[4] is an array of 4 ints; like Simen, let's call it U.
> > Now U[3] is an array of 3 Us; i.e. 3 int[4]s
> > 
> > I read that from left to right, not inside out.
> 
> No, no. You read it outwards from the variable name (which is essentially what 
> you're doing in C), so you read it from right to left. If you read it from left 
> to right it would be an integer of arrays, which makes no sense. It's just like 
> how int* is a pointer to an int, not an int to a pointer. Declarations are read 
> outwards from the variable name (which is usually right to left).

That isn't how you read it.

int* b;

int pointer b.

int[4][3] a;

int array of 4, array of 3 a.

This isn't exactly grammatically clear English. But it isn't English it is D.

int c[3][4];

c is array of 3 int arrays of 4 int. Definitely not left to right.


More information about the Digitalmars-d-learn mailing list