Skip to content

Instantly share code, notes, and snippets.

@penut85420
Created April 21, 2018 04:55
Show Gist options
  • Save penut85420/352a8042a1efeaf116c111d814577fb1 to your computer and use it in GitHub Desktop.
Save penut85420/352a8042a1efeaf116c111d814577fb1 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
using namespace std;
void print_vector(vector<int>& v) {
for(int i = 0; i < v.size(); i++) {
cout << v[i] << " ";
}
}
int main() {
int a[5] = {1, 2, 3, 4, 5};
vector<int> ivector(a, a + 5);
for(int i = 0; i < ivector.size(); i++) {
ivector[i] = i;
}
print_vector(ivector);
cout << a[0];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment