���]�ڦ��@��struct
typedef struct {
int iID;
int* aiList;
}STRUCT_A;
void main()
{
STRUCT_A tA;
//initial struct tA
tA.iID = 100;
ta.aiList = (int*)calloc(5, sizeof(int));
//.....
//reset struct tA
memset(&tA, 0, sizeof(structA;));
==>�g�L�o�ӫ�Astruct ��element ���|�Q�]�� 0
�]�A�ʺA array : aiList
�ڪ����D�O:
(1) �g�Lmemset ��A�o�� aiList �� memory ���Q release �ܡH
���`�� release �|�g��
if (aiList) free(aiList);
aiList = NULL;
�g�Lmemset ��0��A����O�֤Ffree���ʧ@�A�������г]��0
���쥻 aiList ��memory �O���O�|�@���Q��?��{�������H
�]�N�O���A����O aiList �� address �Q�]��0�A�� aiList �� element
���M�٦b�H
(2) �p�G�ڭn���ҤW���o��ơA�аݭn��H
�ڸչL��� aiList �� address �O�U��...���L�n�����O�o���� ...XD
}
���¦U�� :)
--
--
�� �o�H��: �����~�{(ptt.cc)
�� From: 60.251.142.155