假设我有以下程序,
typedef struct xyz
{
int abc[6];//int abc;
//int yz;
}xyz;
int main()
{
int *ptr = new int(10);
int *ptr1 = new int(20);
xyz* XYZ = reinterpret_cast <xyz*>(ptr); //Initializes XYZ->abc[0]
XYZ = reinterpret_cast <xyz*>(ptr1);//Initializes XYZ->abc[0]
}
这里的值进入zeroth location
。如果我想将值推入XYZ->abc[1]
,那么我该怎么做呢?