Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // blah.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- void main() {
- int year = 9;
- cout << "The value of year is :\t" << year << endl;
- cout << "The addr of Year is :\t" << &year << endl;
- char name[] = "Monkeys make horrible employees. and they never share their bananas!";
- char addr[] = "a";
- cout << "the name is : " << name << endl;
- cout << "the address of name is : " << &name << endl;
- cout << "The length of name is: " << sizeof(name) << endl;
- cout << "The addr is: " << addr << endl;
- cout << "The addr of addr is: " << &addr << endl;
- cout << "The length of addr is: " << sizeof(addr) << endl;
- system("pause");
- char *pBetty, *pJane, *pConnie;
- cout << "The address Betty is stored in is: ";
- printf("0x%08x\n", &pBetty);
- cout << "The address Jane is stored in is: ";
- printf("0x%08x\n", &pJane);
- cout << "The address Connie is stored in is: ";
- printf("0x%08x\n", &pConnie);
- pBetty = NULL;
- pJane = NULL;
- pConnie = NULL;
- pBetty = new char;
- pJane = pBetty;
- pConnie = pBetty;
- *pBetty = 'a';
- delete(pBetty);
- pBetty = NULL;
- *pJane = 'k';
- string *pSilly = new string();
- system("pause");
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement