This is very surprising. When I was learning C, I was convinced that array size must be determined at compile time, and I never wrote a line of code that violate this. Today, my friend (a C beginner) asked me to help him to debug his code. His code contains following lines:
[sourcecode lang=”c”] ….. int T, R, C, i, j; ….. char tile[R][C]; ….. [/sourcecode]
To my great surprise, this code compiles with no error. According to this post and this page, C99 allows array size to be a variable, which is supported by GCC. This feature may free programmer from many new, delete, malloc, free and memory leak in many cases.