end() is the pointer to the end of a list : list begin end « list « C++ Tutorial






#include <iostream>
#include <list>
using namespace std;
   
int main()
{
  list<int> lst;
  int i;
   
  for(i=0; i<10; i++) lst.push_back(i);
   
  cout << "List printed forwards:\n";
  list<int>::iterator p = lst.begin();
  while(p != lst.end()) {
    cout << *p << endl;
    p++;
  }
   
  cout << "List printed backwards:\n";
  p = lst.end();
  while(p != lst.begin()) {
    p--;
    cout << *p << " ";
  }
   
  return 0;
}








17.4.list begin end
17.4.1.Accessing the Front and Back of a List with while loop
17.4.2.Accessing the Front and Back of a List with for loop
17.4.3.end() is the pointer to the end of a list
17.4.4.list.begin and list.end