In the following code, I provide the size of the array at runtime.
#include <stdio.h>
int main()
{
int i;
scanf("%d",&i);
int a[i];
}
Please tell me the difference between the code above and the code with malloc(). I know that array storage is on the stack, and dynamic memory ( malloc, callocetc.) is on the heap. So does my code work like malloc? If not, explain.
source
share