#include <stdlib.h>
#include <stdio.h>
void foo();
int *var;
int main()
{
// Memory allocation for var
var=(int*)malloc(sizeof(int)*4);
// Set and display data
var[0] = 4;
printf("%d ", var[0]);
// Free memory space of the pointers
free(var);
printf("%d ", var[0]);
// Call a function for alloca()
foo();
//free(var);
return 0;
}
void foo()
{
var=(int*)alloca(sizeof(int)*4);
var[0] = 4;
}