Skip to content

Instantly share code, notes, and snippets.

@davidsanfal
Forked from fcofdez/a.cpp
Last active August 29, 2015 14:21
Show Gist options
  • Save davidsanfal/9729c32bed7acf412d9d to your computer and use it in GitHub Desktop.
Save davidsanfal/9729c32bed7acf412d9d 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