Question: The following code introduces a variable - length array ( VLA ) on the stack: int size = 0 ; std::cin > > size; int
The following code introduces a variablelength array VLA on the stack:
int size ;
std::cin size;
int arraysize;
Is this code valid per the C standard?
No since the code will not compile on any modern C compiler.
No the C standard states that the compiler must know a stack array's size at compile time.
Yes, variablelength arrays are valid in the C standard.
Yes, variablelength stack arrays are valid per the C standard.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
