Proper way to empty a C-String
It depends on what you mean by “empty”. If you just want a zero-length string, then your example will work. This will also work: If you want to zero the entire contents of the string, you can do it this way: but this will only work for zeroing up to the first NULL character. If … Read more