>> I have not given a size to the vector.Could it be because of that?
Well, if your vectors are empty, how could you expect to be able to access elements of them? I think people reading your example assumed it was not real code, just an example of the syntax that was erroneous.
Is your error occurring when you run the program or when you compile it?
You have to populate a vector with elements before you can access any. That's pretty obvious.
mike_2000_17
Posting Virtuoso
2,139 posts since Jul 2010
Reputation Points: 1,634
Solved Threads: 457