zeroing out memory
- by robUK
Hello,
gcc 4.4.4 c89
I am just wondering what most c programmers do when they want to zero out memory.
For example I have a buffer of 1024 bytes. Sometimes I do this:
char buffer[1024] = {0};
Which will zero all bytes.
However, should I declare like this and use memset?
char buffer[1024];
.
.
memset(buffer, 0, sizeof(buffer);
Is there any real reason you have to zero the memory? What is the worst that can happen by not doing it?
Many thanks for any suggestions,