I have this code below which creates an array of variable size that compiles and runs fine on my mac.
#include <stdio.h>
#include <stdlib.h>
int main(){
int w = 100;
int ar[w];
ar[2] = 42;
printf("%d\n",ar[2]);
}
I thought variable sized arrays were not permitted in C. what is happening here exactly? How is memory being managed? Does the memory get dynamically allocated at run time? Thanks
-42?