Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- // initial vars
- char Target[50] = "-X- Teknogods -X-";
- char space1[60] = "- I am between pointer one and Teknogods -";
- char *Pointer1 = NULL;
- char space2[60] = "- I am between pointer one and two -";
- char **Pointer2 = NULL;
- char space3[60] = "- I am between pointer two and three -";
- char ***Pointer3 = NULL;
- char space4[30] = "- I am the end -";
- // set pointers
- Pointer1 = &Target[0];
- Pointer2 = &Pointer1;
- Pointer3 = &Pointer2;
- // show pointers and whats inside
- cout << "sTarget contains: " << Target << endl;
- cout << "Address of sTarget is: " << &Target << endl;
- cout << "---------------------------------------------" << endl;
- cout << "Pointer1 is at address: " << &Pointer1 << endl;
- cout << "Pointer1 contains: " << (void *)Pointer1 << endl;
- cout << "---------------------------------------------" << endl;
- cout << "Pointer2 is at address: " << &Pointer2 << endl;
- cout << "Pointer2 contains: " << (void *)Pointer2 << endl;
- cout << "---------------------------------------------" << endl;
- cout << "Pointer3 is at address: " << &Pointer3 << endl;
- cout << "Pointer3 contains: " << (void *)Pointer3 << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement