Of course, the value used to initialize the vector must have an actual value. Using an uninitialized integer to construct the vector isn't a good idea. The OP might think this obvious but other beginners might someday find this thread and read it. I agree with Bazzy's point that operator new was not needed here at all. I'd just like to see in the example that j has to be filled with a meaningful value first.