Skip to content

Commit

Permalink
Update vector.c
Browse files Browse the repository at this point in the history
  • Loading branch information
wXwSmilewXw committed Nov 22, 2024
1 parent b385b47 commit 27ca431
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions LibraryC/vector.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ void vector_resize(Vector *v, size_t new_size) {
// return;
// }

if (new_size > v->capacity) { // Если новый размер превышает емкость
size_t new_capacity = (v->capacity == 0) ? 1 : v->capacity*2; // Установка новой емкости

size_t new_capacity = (v->capacity == 0) ? 1 : v->capacity; // Установка новой емкости
while (new_capacity < new_size) { // Увеличение емкости до нужного размера
new_capacity *= 2;
}
Expand All @@ -128,7 +128,7 @@ void vector_resize(Vector *v, size_t new_size) {
}
v->data = new_data; // Установка нового массива данных
v->capacity = new_capacity; // Обновление емкости
}

v->size = new_size; // Установка нового размера
}

Expand Down

0 comments on commit 27ca431

Please sign in to comment.