a) v.end()
b) v.cend()
c) both v.end() and v.cend()
d) vectors do not have a function to access the last element
Meghna MittalBegginer
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
d
Explanation: There are no function to access the last element of the vector. The end() and cend() returns the iterator to an element which is kept at the last of the vector to keep the knowledge about the end of a vector. In order to access the last element, you can first find the size and then can use v[size-1] or v.at(size – 1) to access the last element.