I don\'t really understand why I can\'t have a variable size array on the stack, so something like
foo(int n) {
int a[n];
}
As I underst
Stacks are fairly small, and their sizes can vary dramatically per architecture. The problem is that it is fairly easy to 'over-allocate' and cause a seg fault or write over memory owned by somebody else. Meanwhile, solutions to the problem (e.g. vector) have existed for a long time.
FWIW, I read Stroustrup say that he didn't want them, but I don't know which interview it was in.