fork download
  1. #include <cstdio>
  2. #include <list>
  3. class Person{
  4. public:
  5. int age;
  6. int weight;
  7. Person(int age, int weight):age(age), weight(weight){}
  8. };
  9. int main() {
  10. std::list<Person> ls;
  11. ls.push_back(Person(20, 160));
  12. ls.push_back(Person(25, 180));
  13. ls.push_back(Person(23, 170));
  14. for(auto i=ls.begin();i!=ls.end();++i){
  15. printf("%X %X %d %d\n", &i, &(*i), (*i).age, (*i).weight);
  16. }
  17. }
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
BFE3F88C 88B9010 20 160
BFE3F88C 88B9028 25 180
BFE3F88C 88B9040 23 170