fix: resize array to avoid arrayIndexOutOfBounds (#2979)

This commit is contained in:
Piotr Idzik
2025-08-16 06:58:06 +02:00
committed by GitHub
parent 145111cd7e
commit 63931308e4

View File

@@ -45,7 +45,10 @@ static void tests() {
assert(LinearSearch(array, size, 1) == 1);
assert(LinearSearch(array, size, 2) == 2);
delete[] array;
size = 6;
array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = i;
}