mano M wrote:
> Hi,
> I am wondering why my compiler gcc doesn't complain with following code
>
> #include<iostream>
> int main()
> {
> int j;
> std::cin>>j;
> int k[j];
> }
>
> Without new or malloc ,I could able to allocate memory dynamically.
>
> gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-56)
>
> Can someone clarify it?
>
> Thanks,
> Manoj
More than likely, you are using stack space...assuming the compiler
hasn't completely optimized out the 'int k[j];' line because 'k' is
never used (you should have warnings turned up high enough to get a
warning about this!).
--
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197
*NEW* MyTaskFocus 1.1
Get on task. Stay on task.
http://www.CubicleSoft.com/MyTaskFocus/