Why this also works in C ??? Array memory should be allocated at run time ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this also works in C ??? Array memory should be allocated at run time ???

https://code.sololearn.com/c6IzK70G9EZ4/?ref=app

6th Mar 2019, 3:24 AM
Aman Jain
Aman Jain - avatar
2 Answers
+ 7
It doesn't work. n needs to be a constant expression. Just because the compiler doesn't show a warning or an error doesn't mean that the syntax is correct
6th Mar 2019, 6:29 AM
Anna
Anna - avatar
6th Mar 2019, 8:35 AM
HonFu
HonFu - avatar