- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Array::crbegin() and array::crend() in C++ STL?
Here we will see the crbegin() and crend() functions of array in C++ STL.
The array::crbegin() function is used to get reverse iterator. It returns constant reverse iterator pointing to the last element of the container. This function does not take any parameter.
The array::crend() function is reverse of crbegin(). This returns the iterator which is pointing the last element of the reversed iterator.
Let us see some code examples to get better idea.
Example
#include<iostream> #include<array> using namespace std; main() { array<int, 10> arr = {00, 11, 22, 33, 44, 55, 66, 77, 88, 99}; cout << "The list in reverse order: "; for(auto it = arr.crbegin(); it != arr.crend(); it++){ cout << *it << " "; } }
Output
The list in reverse order: 99 88 77 66 55 44 33 22 11 0
Advertisements