Skip to content

Commit 484524e

Browse files
Merge pull request wangzheng0822#106 from wustzjf/patch-1
Update array.c
2 parents 1163863 + 652d6b2 commit 484524e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

c-cpp/05_array/array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ int insert(struct array *array, int elem)
3333
}
3434

3535
if (idx < array->used)
36-
memmove(&array->arr[array->used], &array->arr[idx],
36+
memmove(&array->arr[idx+1], &array->arr[idx],
3737
(array->used - idx) * sizeof(int));
3838

3939
array->arr[idx] = elem;

0 commit comments

Comments
 (0)