Skip to content
Snippets Groups Projects
Commit 7875d981 authored by Vicens Quentin's avatar Vicens Quentin
Browse files

fin TP1

parent ddb96a61
No related branches found
No related tags found
No related merge requests found
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
......@@ -11,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;
......@@ -28,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) {
......@@ -37,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) {
......
File moved
File moved
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