summaryrefslogtreecommitdiff
path: root/c,cc/vector_pointer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'c,cc/vector_pointer.cc')
-rw-r--r--c,cc/vector_pointer.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/c,cc/vector_pointer.cc b/c,cc/vector_pointer.cc
new file mode 100644
index 0000000..70251e6
--- /dev/null
+++ b/c,cc/vector_pointer.cc
@@ -0,0 +1,19 @@
+#include <vector>
+#include <iostream>
+
+using namespace std;
+
+int main(void)
+{
+ vector<char> x;
+ x.push_back('a');
+ x.push_back('b');
+ x.push_back('c');
+ char* p = &(x[1]);
+ cout << *p << endl;
+ x[1] = 'x';
+ cout << *p << endl;
+
+ return 0;
+}
+