Skip to content

Instantly share code, notes, and snippets.

@fcofdez
Created May 15, 2015 14:44
Show Gist options
  • Save fcofdez/ae0672b4c6913e4f5723 to your computer and use it in GitHub Desktop.
Save fcofdez/ae0672b4c6913e4f5723 to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <stdio.h>
int main(){
int *a;
a = (int *) malloc(sizeof(int) * 12);
for (int i = 0; i < 12 ; i++)
a[i] = i;
for (int i = 0; i < 12 ; i++)
printf("%i\n", a[i]);
a = (int *) realloc((void *) a, sizeof(int) * 25);
for (int i = 12; i < 24 ; i++)
a[i] = i;
for (int i = 0; i < 24 ; i++)
printf("%i\n", a[i]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment