cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Memory Questions
Memory Questions
Jun 23, 2013 at 3:53pm UTC
yelnatz
(100)
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?
Jun 23, 2013 at 4:06pm UTC
ne555
(10692)
`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.
Jun 24, 2013 at 12:16am UTC
yelnatz
(100)
Thanks bud.
Topic archived. No new replies allowed.