Originally posted by ayumi
another thing is ..... do i need to delete the vector after used??
Yes and no...depending where you created the vector...
Code:
// Stack
int main()
{
  std::vector<int> IntVector;

  // No need to explicitely delete the vector, will be done implicitely

  return 0;
}


// Heap
int main()
{
  std::vector<int> *PointerToIntVector = new std::vector<int>;

  // Here we need to explicitely delete the vector, otherwise we will have a memory leak...
  delete PointerToIntVector;

  return 0;
}