Function rc_vector_duplicate#

Function Documentation#

int rc_vector_duplicate(rc_vector_t a, rc_vector_t *b)#

Duplicates the contents of vector a and into a new vector b.

Simply making a copy of an rc_vector_t struct is not sufficient as the rc_vector_t struct simply contains a pointer to the memory allocated to contain the contents of the vector. rc_vector_duplicate sets b to be a new rc_vector_t with a pointer to freshly-allocated memory.

Parameters:
  • a[in] Vector to be duplicated

  • b – pointer to new vector to be allocated and written

Returns:

Returns 0 if successful, otherwise returns -1.