iter2.cpp

We use cookies. Read the Privacy and Cookie Policy

iter2.cpp

#include ‹iostream.h›

#include ‹stl.h›

void print (const vector‹const char*›& v_) {

 vector‹const char*›::const_iterator i;

 for (i = v_.begin(); i != v_.end(); i++) cout ‹‹ *i ‹‹ endl;

}

int main() {

 vector‹const char*› v; // Vector of character strings.

 v.push_back((char*) "zippy");

 v.push_back((char*) "motorboy");

 print (v);

 return 0;

}