Realloc doesn't shrink memory? (C)
Advertisements I have this simple code snippet as seen below: #include <stdio.h> #include <stdlib.h> int main() { int size; int *a, *a2; size = 5; a = malloc(size * sizeof(int)); if(a == NULL) { fprintf(stderr, "Failure at allocating memory for array.\n"); abort(); } for(int i = 0; i < size; i++) { a[i] = i… Read More Realloc doesn't shrink memory? (C)