Memory Questions

If you have lets say:

1
2
3
4
5
6
7
8
void main(){
  vector<int> x;

  x.push_back(1);
  x.push_back(1);
  x.push_back(1);
  ...
}


Where is this stored in memory? I mean, should this go to the stack? heap? I'm just confused since I'm not using 'new' which is an obvious sign it goes to the heap.

constants go to the stack right?
`x' is in the stack (don't worry, it's lightweight)
`x[0]' would go to the heap
vector uses new internally.

main must return int.
Thanks bud.
Topic archived. No new replies allowed.