Hi guys!
I'm taking over the C language after more than a year, and I suddenly collapsed a certainty
As far as I know, when you define an array of its size should be known at compile time, and in particular it should be a constant. Now, doing some evidence, I realize that compiling and running a program like this:
not only do not get errors in compiling, but not even a segmentation fault at runtime.Code:# include <stdio.h> int main (void) ( int c; int DIM; printf ( "Enter array size:"); scanf ( "% d", & DIM); int string [SIZE]; for (c = 0; c <DIM, c + +) string [c] = c; printf ( "\ nFine \ n"); return 0; )
If you could explain to me why?
Accurate use gcc version 4.2.4 on Linux 2.6.24 64-bit
Bookmarks