If it's strings you are copying you can use strncpy
to copy the string and the extra buffer space will be filled with \0
for you.
If for whatever reason you are using strcpy
or copying the string by hand then yes, you can save yourself the loop because all standard string operations (strlen
, strcpy
, etc) will stop at the first \0
anyway.