cend() Function in C++ Last Updated : 27 Nov, 2022 Comments Improve Suggest changes Like Article Like Report Cend() is the function defined in C++ STL. This function produces a constant random access iterator that identifies the deque's past-the-end element. If the container is empty then cend() function returns the same as cbegin() function. This member function's iterator can only be used to iterate containers; it cannot be used to change the content of the object it is pointing at. Syntax: const_iterator cend() const noexcept; A const_iterator is an iterator that points to constant content. Example 1: Below is the C program to use cend() function in deque to print elements in reverse order: C++ // C++ code demonstrating the use // of cend() function in deque // to print elements in reverse // order. #include <iostream> #include <deque> using namespace std; // Driver code int main() { // Initialising the deque deque<int> d = {1, 2, 3, 4, 5}; cout << "Elements of deque in reverse order: " << endl; for (auto it = d.cend() - 1; it >= d.cbegin(); --it) cout << *it << " "; cout << endl; return 0; } OutputElements of deque in reverse order: 5 4 3 2 1 Time Complexity: O(n) where n is the number of elements in the deque.Auxiliary Space: O(1) Example 2: Below is the C program to use cend() function in deque to print elements of deque: C++ // C++ code demonstrating the use // of cend() function in deque // to print elements of deque #include <iostream> #include <deque> using namespace std; // Driver code int main() { // Initialising the deque deque<string> d = {"geeks","for","geeks"}; auto itr = d.cbegin(); // Printing the deque with // help of cend() function while(itr != d.cend()) { cout << *itr; cout << " "; ++itr; } return 0; } Outputgeeks for geeks Time Complexity: O(n) where n is the number of elements in the deque.Auxiliary Space: O(1) Comment More infoAdvertise with us Next Article cend() Function in C++ P pushpeshrajdx01 Follow Improve Article Tags : Technical Scripter C++ Technical Scripter 2022 STL cpp-deque cpp-deque-functions +2 More Practice Tags : CPPSTL Similar Reads Functions in C++ A function is a building block of C++ programs that contains a set of statements which are executed when the functions is called. It can take some input data, performs the given task, and return some result. A function can be called from anywhere in the program and any number of times increasing the 9 min read C ceil() Function In the C language, the <math.h> header file contains the Standard Math Library that provides various mathematical functions, including the ceil() function. In this article, we will see how to use the ceil() function in C.What is ceil() in C?C ceil() is a built-in library function that computes 3 min read list end() function in C++ STL The list::end() is a built-in function in C++ STL which is used to get an iterator to past the last element. By past the last element it is meant that the iterator returned by the end() function return an iterator to an element which follows the last element in the list container. It can not be used 2 min read exp() function C++ The exp() function in C++ returns the exponential (Euler's number) e (or 2.71828) raised to the given argument. Syntax for returning exponential e: result=exp() Parameter: The function can take any value i.e, positive, negative or zero in its parameter and returns result in int, double or float or l 2 min read std::function in C++ The std::function() in C++ is a function wrapper class which can store and call any function or a callable object. In this article, we will learn about std::function in C++ and how to use it in different cases.Table of ContentWhat is std::function in C++?Example of std::functionMember Functions of s 5 min read Like