eteran / c-vector

A dynamic array implementation in C similar to the one found in standard C++
MIT License
737 stars 109 forks source link

False result from copy a vector #8

Closed hieutran29 closed 4 years ago

hieutran29 commented 4 years ago

When I tried to copy a vector to a new one using the operator =, everything went fine until I changed a value of the original vector, the second vector changed alongside the original vector. It is expected that the second vector didn't change whether the original one made any change. I suggest implementing a function cvector_copy() to fix the issue.

eteran commented 4 years ago

Yea, this isn't c++, so we can't overload the assignment operator. But sure, your cvector_copy seems reasonable enough :-)