forked from 131/lab5_ivec
vector_test.c done first ver
This commit is contained in:
6
vector.c
6
vector.c
@@ -49,9 +49,7 @@ vector_len(const ivector *v)
|
||||
assert(v);
|
||||
|
||||
// <YOURCODE>
|
||||
v->n;
|
||||
|
||||
return 0;
|
||||
return v->n;
|
||||
}
|
||||
|
||||
int *
|
||||
@@ -128,7 +126,7 @@ vector_insert(ivector *v, size_t idx, int val)
|
||||
assert(v && v->n >= idx);
|
||||
// <YOURCODE>
|
||||
|
||||
if(v->==v->maxsz){
|
||||
if(v->n == v->maxsz){
|
||||
size_t new_maxsz = v->maxsz * VECTOR_GROW_FACTOR;
|
||||
if (new_maxsz==0)
|
||||
new_maxsz = VECTOR_START_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user