I am not able to understand how variable size array works , whether memory for it is allocated on stack or somewhere else and how information about its size is obtained.
i tried the following code
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
printf("%d\n",sizeof(arr));
return 0;
}
i mean i memory is allocted on stack ,then before running this function the stack frame is to be allocated and memory for local variables has to be allocated ,but the size of array is known after the function calls scanf().