What is the difference between begin() and cbegin() in vectors?

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?”

  1. 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.

Leave a Comment