How can i create a dynamic array? I tried with that code:
#include <stdlib.h>
#include <stdio.h>
int main()
{
int size=0,*value,array[size];
printf("How many array elements do you need?");
scanf_s("%i",&size);
value = (int *)malloc(size*sizeof(int));
printf("Your array has now %i elements.Here are the contents:",size);
for(i=0;i<size;i++)
{
printf("%i",array[i]);
}
return 0;
}
How can i realize that? My program(Visual Studio 2013) gives errors.