[Solved] using realloc in C with malloc [closed]


if (newsize == 0) {
    free(ptr);
    return;
}
if (ptr == NULL)
    return malloc(size);

// otherwise do a true realloc

As for

What if there is not a contigious size of the size wanted.

Then realloc returns NULL and sets errno to indicate the error.

9

solved using realloc in C with malloc [closed]