diff options
Diffstat (limited to 'c,cc/pointer_to_element.cc')
-rw-r--r-- | c,cc/pointer_to_element.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/c,cc/pointer_to_element.cc b/c,cc/pointer_to_element.cc new file mode 100644 index 0000000..5a11919 --- /dev/null +++ b/c,cc/pointer_to_element.cc @@ -0,0 +1,19 @@ +#include <vector> +#include <iostream> + +using namespace std; + +int +main(void) +{ + vector<char> bla; + bla.reserve(2); + bla.push_back('a'); + char* p = &bla.at(0); + cout << *p << endl; + bla.push_back('b'); + cout << *p << endl; + + return 0; +} + |