Skip to content
Snippets Groups Projects
Commit 866fa7e1 authored by Baviere Merlin's avatar Baviere Merlin
Browse files

fix tp1

parent e8c0f8db
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ int *resize_array(int *array, size_t old_count, size_t new_count) {
}
int *ret = (int *)realloc(array, new_count * sizeof(int));
//@ split ret==0;
if (!ret) {
free(array);
return 0;
......@@ -27,6 +28,7 @@ void func(void) {
int *array = (int *)malloc(OLD_SIZE * sizeof(int));
if (0 == array) {
/* Handle error */
return;
}
for (size_t i = 0; i < OLD_SIZE; ++i) {
......@@ -36,6 +38,7 @@ void func(void) {
array = resize_array(array, OLD_SIZE, NEW_SIZE);
if (0 == array) {
/* Handle error */
return;
}
for (size_t i = 0; i < NEW_SIZE; ++i) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment