Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
size_t str_size = calc_size(other_string);
if (str_size != 0) {
  char *str_copy = malloc(str_size);
  // check return value
  strncpy(str_copy, other_string, str_size);
}