// expre_Address_Of_Operator3.cpp
// compile with: /EHsc
// Demonstrate address-of operator &
#include <iostream>
using namespace std;
// Function argument is pointer to type int
int square( int *n ) {
return (*n) * (*n);
}
int main() {
int mynum = 5;
cout << square( &mynum ) << endl; // pass address of int
}
Output
25
注:相关教程知识阅读请移步到C++教程频道。










