|
왕대박 님이 쓰신 글 :
: 음.. 안녕하세요.
: 저는 각종 배열의 초기화는 ZeroMemory라는 API를 사용합니다만...
: 뭐.. 이렇게요..
: //---------------------------------------------------------------------------
: // NULL로 초기화 됩니다.
: //---------------------------------------------------------------------------
:
: void __fastcall TForm1::Button4Click(TObject *Sender)
: {
: try
: {
: void* abc[100];
: ZeroMemory(abc, sizeof(abc));
: ShowMessage("초기화 완료");
: }
: catch(...)
: {
: ShowMessage("초기화 No완료");
: }
: }
: //---------------------------------------------------------------------------
: // 0 (zero)로 초기화됩니다.
: //---------------------------------------------------------------------------
: void __fastcall TForm1::Button5Click(TObject *Sender)
: {
: try
: {
: int abc[100];
: ZeroMemory(abc, sizeof(abc));
: ShowMessage("초기화 완료");
: }
: catch(...)
: {
: ShowMessage("초기화 No완료");
: }
:
: }
:
: //---------------------------------------------------------------------------
: // 참고~
: //---------------------------------------------------------------------------
: The ZeroMemory function fills a block of memory with zeros.
:
: VOID ZeroMemory(
: PVOID Destination, // address of block to fill with zeros
: DWORD Length // size, in bytes, of block to fill with zeros
: );
:
: Parameters
:
: Destination Points to the starting address of the block of memory to fill with zeros.
: Length Specifies the size, in bytes, of the block of memory to fill with zeros.
:
:
: 하지만,
: void * abc[134297727];
: 라는 어마어마한 메모리는 어떤 Machine과 컴파일러에서 잡을수 있는지는 모르겠습니다.
: 기본적으로 Pointer는 4byte처리되니깐...
: 134297727 * 4 byte = 537190908 byte
: 대략~~ 530MByte 정도의 메모리인데.... --;;;
:
: 그럼.. 즐프하세요..
:
:
: 행인1 님이 쓰신 글 :
: : 위와 같이 선언된 배열을 NULL로 초기화 하고 싶습니다.
: :
: : 한번에 할수 있는 쉬운 방법이 없을까요?
: :
: : 루프를 돌리면 언제 끝날지도 모르겠더라구여.
: :
: :
: : 알려주세요
|