Monday, February 23, 2009

Avoid memory wastage

Clean up memory spaces that are no longer used.
function_t(int val)
{
char *msg = new char[30];

if(val == VALID)
{
//do processing....
}
else
{
//don't just return.clean the memory that was alloted.
delete [] msg;
return false;
}
}

Author : Arthi

0 nhận xét:

Post a Comment