1 year ago

#383244

test-img

sushi

multiset.end() return value in C++

Why does multiset.end() return a different value when compared to vector.end().

int main(){
    multiset<int>v={1,2,3,4,5,6,7,8};
    cout<<*v.end()<<endl;
    return 0;
}

In case of multiset, it returns a value of total elements present in the multiset.

int main(){
    vector<int>v={1,2,3,4,5,6,7,8};
    cout<<*v.end()<<endl;
    return 0;
}

Whereas vector returns 0.

c++

vector

multiset

0 Answers

Your Answer

Accepted video resources