KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I understand from the answer to this question that values of global/static uninitialized int will be 0. The answer to this one says that for vectors, the default constructor for the object type will be called. I am unable to figure out - what happens when I have vector<int> v(10) in a local function. What is the default constructor for int ? What if I have vector<int> v(10) declared globally? What I am seeing is that vector<int> v(10) in a local function is resulting in variables being 0 - but I am not sure if that is just because of my compiler or is the fixed expected behaviour.
Tags (comma-separated)
Save Edits
Cancel