int foo(double, double);
int main()
{
int arr[5] = {1, 2, 3, 4, 5};
// 指向数组元素的指针
int* p = arr;
for(int i=0; i<5; ++i) cout << p[i] << " ";
cout << endl;
// 指针数组
int* q[3];
q[0] = arr;
for(int i=0; i<5; ++i) cout << q[0][i] << " ";
cout << endl;
// 数组指针
int (*r) [5];
r = &arr;
for(int i=0; i<5; ++i) cout << (*r)[i] << " ";
cout << endl;
// 函数指针
typedef int (*FuncPointer) (double, double);
FuncPointer fp = foo;
cout << "fp: " << fp(1, 3) << endl;
cout << "fp: " << (*fp)(3, 1) << endl;
system("PAUSE");
}
int foo(double a, double b)
{
if(a > b) return 1;
else return 0;
}