// ex1.cpp
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
char * Fred="text";
char * Okfred;
int a=46;
int * d=&a;
char * Fred2=Fred;
int * ptra = &a;
int c = *ptra;
int b[2];
int * Ptrb=b;
*++ptra;
++(*d) ;
int * myint= new int;
Okfred=(char *)new char[strlen("david")+1];
Fred=Okfred;
*Okfred++='d';
*Okfred++='a';
*Okfred++='v';
*Okfred++='i';
*Okfred++='d';
*Okfred= '\0';
*(Fred+1)='2';
cout << "c = " << c<< endl;
cout << "*d= "<< *d << endl;
cout << "d= " << d<< endl;
cout << "Fred = "<< Fred << endl;
cout << "Fred2 = "<< Fred2<< endl;
cout << "Address of b is "<< b<< endl;
cout << "Address of b[0] is " << &b[0]<< endl;
cout << "Address of b[1] is " << &b[1] << endl;
cout << "Address of Ptrb is " << Ptrb++<< endl;
cout << "Address of Ptrb is " << Ptrb << endl;
delete [] Fred;
delete myint;
return 0;
}
On the next page : Learn about Using Pointers

