valarray end() function in C++ Last Updated : 24 Oct, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The end() function is defined in valarray header file. This function returns an iterator pointing to the past-the-end element in the valarray v. Syntax: template< class T > end( valarray<T>& v ); Parameter: This function takes a mandatory parameter v which represents the valarray object. Returns: This function returns the iterator to the past-the-end in the valarray. Below programs illustrate the above function: Example 1:- CPP // C++ program to demonstrate // example of end() function. #include <bits/stdc++.h> using namespace std; int main() { // Initializing valarray valarray<int> varr = { 10, 20, 30, 40, 50 }; cout << "valarray contains="; for (auto i = begin(varr); i != end(varr); i++) { cout << ' ' << *i; } cout << endl; return 0; } Output: valarray contains= 10 20 30 40 50 Example 2:- CPP // C++ program to demonstrate // example of end() function. #include <bits/stdc++.h> using namespace std; int main() { // Initializing valarray valarray<int> varr = { -10, -20, -30, -40 }; cout << "valarray contains="; for (auto i = begin(varr); i != end(varr); i++) { cout << ' ' << *i; } cout << endl; return 0; } Output: valarray contains= -10 -20 -30 -40 Comment More infoAdvertise with us Next Article PHP end() Function B bansal_rtk_ Follow Improve Article Tags : Misc C++ CPP-Functions cpp-valarray Practice Tags : CPPMisc Similar Reads valarray begin() function in C++ The begin() function is defined in valarray header file. This function returns an iterator pointing to the first element in the valarray v. Syntax: template< class T > begin( valarray<T>& v ); Parameter: This function takes a mandatory parameter v which represents the valarray object 1 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 unordered_map end( ) function in C++ STL The unordered_map::end() is a built-in function in C++ STL which returns an iterator pointing to the position past the last element in the container in the unordered_map container. In an unordered_map object, there is no guarantee that which specific element is considered its first element. But all 3 min read unordered_multiset end() function in C++ STL The unordered_multiset::end() is a built-in function in C++ STL which returns an iterator pointing to the position immediately after the last element in the container or to the position immediately after the last element in one of its bucket. Syntax: unordered_multiset_name.end(n) Parameters: The fu 2 min read PHP end() Function The end() function is an inbuilt function in PHP and is used to find the last element of the given array. The end() function changes the internal pointer of an array to point to the last element and returns the value of the last element.Syntax:end($array)Parameters:This function accepts a single par 2 min read std:: valarray class in C++ C++98 introduced a special container called valarray to hold and provide mathematical operations on arrays efficiently. It supports element-wise mathematical operations and various forms of generalized subscript operators, slicing and indirect access.As compare to vectors, valarrays are efficient in 5 min read Like