#include <iostream> using namespace std; const int MAX = 5; int main(){ void centimize(double*); double varray[MAX] = { 10.0, 43.1, 95.9, 59.7, 87.3 }; centimize(varray); for(int j=0; j<MAX; j++) cout << "varray[" << j << "]=" << varray[j] << " centimeters" << endl; return 0; } void centimize(double* ptrd){ for(int j=0; j<MAX; j++) *ptrd++ *= 2.54; }
7.10.function pointers | ||||
7.10.1. | Using function pointers | |||
7.10.2. | Arrays of pointers to functions | |||
7.10.3. | Use function pointers as a function parameter | |||
7.10.4. | Use typedef to define a function type for function pointer | |||
7.10.5. | arguments passed by reference | |||
7.10.6. | arguments passed by pointer | |||
7.10.7. | array passed by pointer | |||
7.10.8. | orders two arguments using pointers | |||
7.10.9. | sorts an array using pointers | |||
7.10.10. | Function pointer for overloaded function |