// 範例 1 #includeusing namespace std; int main() { int x = 123; int *x1 = &x; int **x2 = &x1; int ***x3 = &x2; cout << "x = " << x << endl << endl; cout << "*x1 = " << *x1 << endl; cout << "x1 = " << x1 << endl << endl; cout << "**x2 = " << **x2 << endl; cout << "*x2 = " << *x2 << endl; cout << "x2 = " << x2 << endl<< endl; cout << "***x3 = " << ***x3 << endl; cout << "**x3 = " << **x3 << endl; cout << "*x3 = " << *x3 << endl; cout << "x3 = " << x3 << endl<< endl; }
//範例 2 #includeusing namespace std; void f( char **fc ){ *fc=" "; } int main(){ char *c = "123"; f(&c); cout << c; }
沒有留言:
張貼留言