C++ Vector crbegin()The crbegin() function stands for reverse beginning. It is used to point the last character of the vector container. crbegin() vs rbegin()The crbegin() function returns the constant reverse iterator while rbegin() function returns the reverse iterator. The element pointed by the rbegin() function can be modified but not by crbegin() function. SyntaxConsider a vector 'v'. Syntax would be: ParameterIt does not contain any parameter. Return valueIt returns constant reverse iterator pointing to the reverse beginning of the container. Example 1Let's see a simple example. Output: Error In this example, we are trying to modify the value using crbegin() function which is not possible in this case. Example 2Let's see another simple example. Output: kiwi In this example, crbegin() function is used to access the last element of the vector container. Example 3Let's see a simple example. Output: 3 In this example, crbegin() function is incremented by 2 to access the third element of the vector and this function access all the elements from backward.
Next TopicC++ Vector
|
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected]
Duration: 1 week to 2 week