//2011/02/25 point day8
//create by lichain
#include <iostream>
using namespace std;
int main(void)
{
int a = 12;
int b = 24;
cout << "===================================\n";
cout << "variable a's value is " << a << "\n";
cout << "variable a's address is " << &a << "\n";
cout << "variable *&a is " << *&a << "\n";
cout << "===================================\n";
cout << "variable b's value is " << b << "\n";
cout << "variable b's address is " << &b << "\n";
cout << "variable *&b is " << *&b << "\n";
cout << "===================================\n\n";
unsigned short int howOld =27;
unsigned short int *pAge=NULL;
pAge=&howOld;
cout << "howOld is " << howOld << "\n";
//cout << "*howOld is " << *howOld << "\n";
cout << "&howOld is " << &howOld << "\n";
cout << "pAge is " << pAge << "\n";
cout << "*pAge is " << *pAge << "\n";
cout << "&pAge is " << &pAge << "\n";
cout << "===================================\n";
*pAge=100;
cout << "howOld is " << howOld << "\n";
//cout << "*howOld is " << *howOld << "\n";
cout << "&howOld is " << &howOld << "\n";
cout << "pAge is " << pAge << "\n";
cout << "*pAge is " << *pAge << "\n";
cout << "&pAge is " << &pAge << "\n";
return 0;
}
2011年2月25日 星期五
[linux][day 8][Pointer]C++
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言