can size of array be determined at run time in c?
As I know, an array needs to have a specific size before compiling time in c. I wonder why this code still works? int s; printf("enter the array size: "); scanf("%d",&s); int a[s]; // Isn't s value determined at run time? Array sizes need to be known with ANSI 89 C. The 99 version of the spec removed this limitation and allowed for variable sized arrays. Here is the documentation no the GNU version of this feature http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_toc.html#SEC49 If you need to allocate an array with dynamic size, you have to get it from the heap, with malloc().