I know the memory allocated dynamically as follow can be free like below:
int *array = malloc(sizeof(int) * 100);
memset(array,0,sizeof(int) * 100);
// use the array
free(array);
(Is the example above applied to C++ only or both C and C++?)
But I do not know if I have to free it when it is used like below (plain C language):
int array[3];
array[0] = 0;
array[1] = 1;
array[2] = 2;
And what is the difference between the two methods to create an array?
Thx a lot!