Using the structure directly assigns a value, all elements in the structure can be transmitted. If it is a variable, it is directly assigned; if it is a pointer, the position indicated by the pointer variable is changed. For example, as follows:
TYPEDEF STRUCT _ASD {char * ch; int}
Asd myasd, theaSD; // Declare two structural myasd.ch = new char [4]; / / For the pointer in the structure in the stack, the first address is 0x00431cf0 strcpy (myasd.ch, "ha"); / / And assign the value myasd.i = 5; // Turn the value of the shaped variable theaSD = myasd; // During the assignment of the structure, the passage of the variable is transmitted to the corresponding variable, the first address of therasd.ch is 0x00431cf0 Printf ("% s And% d", theasd.ch, theasd.i);
Delete [] theasd.ch; // Because it points to the same address, you can use it to release space