Check out example codes for "how to print list in c++". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
#include <list>

std::list<int> listOfNumbers = {1, 2, 3, 4};

for (int item : listOfNumbers)
  std::cout << item << " ";

Learn ReactJs, React Native from akashmittal.com