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);
  if (str_copy == NULL) {
    /* handle error */
  }
  strcpy(str_copy, other_string);
}