Arrays on the stack.

Started by
4 comments, last by Daishim 22 years, 5 months ago
How do I go about putting an array on the stack in C++?

I know only that which I know, but I do not know what I know.
Advertisement
int a[100];
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Or _alloca. Allocates memory from the stack.
quote:Original post by Anonymous Poster
Or _alloca. Allocates memory from the stack.

While true, using alloca is dangerous . Borland supports it without the preceding underscore, GCC and MSVC support it as written, but it is not standard (so be careful if you''re worried about portability).

[Resist Windows XP''s Invasive Production Activation Technology!]
alloca = spawn of satan.
quote:Original post by Stoffel
alloca = spawn of satan.

Actually, I''ve seen it put to good use in the past. But, no, it''s not something I''d openly encourage people to use .

[Resist Windows XP''s Invasive Production Activation Technology!]

This topic is closed to new replies.

Advertisement