a) both are same
b) begin() returns iterator to first element and cbegin() returns iterator to last element
c) begin() returns an iterator to first element whereas cbegin() returns constant iterator to first element
d) begin() returns returns first element cbegin() returns void
1 thought on “What is the difference between begin() and cbegin() in vectors?”
Leave a Comment
You must be logged in to post a comment.
c
Explanation: Both begin() and cbegin() are used to access the first element of the vector. The function begin() returns an iterator to first element whereas cbegin() returns a constant iterator to first element.