Memset 0 or 0x00 ?
Posted on 2014-02-26
I have a query on Memset, which one we need to use 0x00 or 0
char myname; //created a character array and wants to memset it
//Is there any difference in the below lines:
memset (&myname, 0, sizeof(myname));
memset (&myname, 0x00, sizeof(myname)); //some are saying we should use only this. 0x00 will be replaces the string with NULL.
I feel both are same. 0x00 will be converted into int as memset takes 2nd argument as int.
I have seen the visual studio also used both. so where we need to use these two types of memsets? 0x00 in which situation and 0 in which situation.?
C:\program files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcoll.h(2948):
memset( ppBins, 0, nBins*sizeof( CNode* ) );
C:\program files\Microsoft Visual Studio 10.0\VC\atlmfc\include\atlcoll.h(3554):
memset(m_pNil, 0x00, sizeof(CNode));
Please clarify in detail.