C implementation of string copy