我尝试通过不同的方式将一个数组指针复制到另一个数组指针,但没有成功。这是我的尝试,以及相关的错误消息。
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 *’
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用 …
c ×1