aboutsummaryrefslogtreecommitdiff
path: root/libvector.c
diff options
context:
space:
mode:
authorleiyu3 <s444814187@gmail.com>2022-09-22 11:41:31 -0400
committerleiyu3 <s444814187@gmail.com>2022-09-22 11:41:31 -0400
commitc5d89d1ba78a82e6b31aa498fb0f21c4d527e752 (patch)
tree5ac5f694efc95a207dc06e8001003c045982f97c /libvector.c
parentc1baa76ee589ab8158a9f1fb3173149cebe1dd1b (diff)
downloadvector_c-c5d89d1ba78a82e6b31aa498fb0f21c4d527e752.tar.gz
vector_c-c5d89d1ba78a82e6b31aa498fb0f21c4d527e752.zip
write test up to remove_val
Diffstat (limited to 'libvector.c')
-rw-r--r--libvector.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libvector.c b/libvector.c
index b113abe..60e6e42 100644
--- a/libvector.c
+++ b/libvector.c
@@ -33,9 +33,9 @@ int is_full(vector_t vec){
33} 33}
34 34
35int at(vector_t vec, int index){ 35int at(vector_t vec, int index){
36 if (index >= vec.max_size){ 36 if (index >= size(vec) || index < 0){
37 printf("Index out of bound!!\n"); 37 printf("Index out of bound!!\n");
38 exit(1); 38 exit(-1);
39 } 39 }
40 40
41 return vec.arr[index]; 41 return vec.arr[index];
@@ -46,7 +46,7 @@ void push(vector_t *vec, int value){
46 printf("Array out of Size!!\n\ 46 printf("Array out of Size!!\n\
47 Can't push!! \n\ 47 Can't push!! \n\
48 Not yet implemented resize!!\n"); 48 Not yet implemented resize!!\n");
49 exit(1); 49 exit(-1);
50 } 50 }
51 51
52 vec->arr[vec->cur_size] = value; 52 vec->arr[vec->cur_size] = value;