According to c99 standard, we can write the following code and it's totally legal
int x;
scanf("%d",&x);
int ar[x];
My question is, if I can allocate an array like this, why would I ever need malloc to allocate variable size arrays again?
Also, could you please explain how does the variable length arrays allocation happens? Deep inside, does it call malloc to allocate the array or what?
Two reasons spring to my mind:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With