Strange memory allocation int a[atoi(argv[1])] ?!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux