* pmovie;
std;
movies_t
{ string title; year; };
main () { string mystr; movies_t amovie; movies_t * pmovie; pmovie = &amovie; cout << "Enter title: "; getline (cin, pmovie->title); cout << "Enter year: "; getline (cin, mystr); (stringstream) mystr >> pmovie->year; cout << "\nYou have entered:\n"; cout << pmovie->title; cout << " (" << pmovie->year << ")\n"; 0; }
。這是一個間接引用操作符,常與的一起使用,以便引用其中的成員元素,例如:
: