•//
using initialization
•
•void
func()
•{
• int array2El[2] = { 1, 2 };
• int array[SIZE] = {1}; // fills
the rest with 0’s
•}
•
•//
using memset (to fill array with a constant value)
•memset
(array, 0, sizeof(array)); // fills
bytes, not dwords
•
•//
using FillMemory
•FillMemory
(array, sizeof(array), 0);
•
•//
using ZeroMemory
•ZeroMemory
(array, sizeof(array));
•
•//
using SecureZeroMemory (W2K3)
•SecureZeroMemory
(array, sizeof(array));
•
•void
Sample() // from MSDN
•{
• WCHAR szPassword[MAX_PATH];
•
• if (GetPasswordFromUser(szPassword,
MAX_PATH)) // this function retrieves
a
•
// password
• UsePassword(szPassword);
• SecureZeroMemory(szPassword, sizeof(szPassword)); // clear the password from memory
•}
•
•