cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Vecor
Vecor
Oct 6, 2013 at 7:32pm UTC
hellcoder
(114)
here why we have used " v(myints,myints+5) " there are 5 elements in array so why we haven't used v(myints,myints+4)?? because for 5 elements we use indexes 0 to 4 in an array?
1
2
int
myints[] = {10,20,30,5,15}; std::vector<
int
> v(myints,myints+5);
Oct 6, 2013 at 7:55pm UTC
MiiNiPaa
(8886)
End iterator should point past last element of the array.
Like we would use 5 in for loop condition.
Oct 6, 2013 at 8:00pm UTC
hellcoder
(114)
^ but there is < sign not a <= sign in array ?
is it the same in vector like std::vector<int> v(myints,myints+5);
like for(i=0;i<5;i++)
cin>>v[i];
Topic archived. No new replies allowed.