I tried through different ways to copy an array pointer to another one, without any success. Here are my attempts, with the associated error message.
typedef long int coordinate;
typedef coordinate coordinates[3];
void test(coordinates coord) {
coordinates coord2 = coord; // error: invalid initializer
coordinates coord3;
coord3 = coord; // error: incompatible types when assigning to type ‘coordinates’ from type ‘long int *’
coord3 = (coordinates) coord; // error: cast specifies array type
coord3 = (coordinate[]) coord; // error: cast specifies array type
coord3 = (long int*) coord; // error: incompatible types when assigning to type ‘coordinates’ from type ‘long int *’
}
I know I could use typedef coordinate* coordinates;
instead, but it does not look very explicit to me.