Skip to content

Instantly share code, notes, and snippets.

@imduffy15
Created March 29, 2013 16:53
Show Gist options
  • Select an option

  • Save imduffy15/5272060 to your computer and use it in GitHub Desktop.

Select an option

Save imduffy15/5272060 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
int main() {
std::vector <std::string *> pointers(10);
pointers[0] = new std::string("Hello");
pointers[5] = new std::string("I'm index 5");
for(int i=0;i<pointers.size();i++) {
if(pointers[i] != 0) {
std::cout << *pointers[i] << "\n";
} else {
std::cout << pointers[i] << "\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment