L
LinuxGuy
Can someone please tell if following code leaks memory
void someFunction()
{
char MyArray[512];
memset(MyArray,0,512);
}
void someFunction()
{
char MyArray[512];
memset(MyArray,0,512);
}
> [non-quoting]
No - it can't leak. However it is better to write
memset(MyArray,0,sizeof(MyArray));
to avoid duplicating of magic number (512).
LinuxGuy said:even if I don't use memset() and just declare the array then will it be
deallocated when function exits..
LinuxGuy said:even if I don't use memset() and just declare the array then will it be
deallocated when function exits..
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.