1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| #include<iostream> using namespace std; int main() { typedef unsigned short int ut; ut i = 5; ut *p = 0; p = &i; cout << "i=" << i << endl; cout << "*p=" << *p << endl; cout << "用指针来修改存放在i中的数据。。" << endl; *p = 90; cout << "i=" << i << endl; cout << "*p=" << *p << endl; cout << "用i来修改存放在i中的数据。。" << endl;
i = 9; cout << "i=" << i << endl; cout << "*p=" << *p << endl; return 0;
}
|