<p>Okay i am working on someone elses code. They do alot of this:</p>

<pre><code>char description[256];
description[0]=0;
</code></pre>

<p>I know this would put a \0 in the first spot of the character array. But is this even a safe way to erase a string?</p>

<p>Also visual studio keeps reporting memory leaks, and i've pretty much tied this done to the strings that are used.</p>

<p>Ps. Yes i know about std::string, yes i use that. This isn't my code.</p>

This string is allocated on the stack, so there's no way to free the memory it uses until the function that it's called in returns (when it will happen automatically). Unless you're calling this function recursively*, there's no way this will end up being a memory leak, because once the function returns the space is used for future stack frames. And if you're concerned about security, you should just loop through and zero out the elements of the string.
If you want a free()-able memory block, you could do the following and allocate the array on the heap:
```
```
char *str = malloc(256*sizeof(char)); // str now is a pointer to a 256-char array
...
// some code here
...
free(str); // free the memory
```
```
*this is not an acutal memory leak, but some people say "memory leak" when they mean "run out of memory". In any case, stack space is much more limited than heap space, so you have to watch the size of memory blocks you use there.