Strange memory allocation int a[atoi(argv[1])] ?!
chimi
gchimi@gmail.com
Mon Jun 11 19:04:00 GMT 2007
Hello!
I've just heard that teachers from one of the university of technology say
that:
int a[atoi(argv[1])];
is correct way to dynamic allocation... what is more it looks like x =
a[999999]; works! o_O
but I run memusage test-prog 1000000 and it doesn't call *alloc nor free at
all, but works well...
in the other hand
int a[32];
doesn't allow to acces its 1000000 element (it's ok of course)
I wanted to know what gcc does with atoi(argv[2])? Does it only OS allocate
so huge heap so it works?
Or do they wrong?
--
chmi
--
View this message in context: http://www.nabble.com/Strange-memory-allocation-int-a-atoi%28argv-1-%29---%21-tf3902478.html#a11063582
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list