Posts: 53
Threads: 3
Joined: Aug 2016
Reputation:
0
Just do str[0] = '\0', there's no need to overwrite the entire array and just adds an unneccessary overhead.
C-style strings should be always ended with an EOS ('\0), that's how all string manipulating functions work. strlen() counts characters until it finds a \0
And anyway, if you use format() there's no need to do this because it overwrites the entire string with newly formatted one anyway, you need to use that only if you want to for example use strins()