Login    New User    Forgot Password    Help      

Function Pointers

GO TO INDEX

Just as we have arrays of variables, so also we have arrays of pointers. For example,

int *p[5];

Example

#include <iostream>

int main ()
{
int numbers[5];
int * p;
p = numbers; *p = 10;
p++; *p = 20;
p = &numbers[2]; *p = 30;
p = numbers + 3; *p = 40;
p = numbers; *(p+4) = 50;
for (int n=0; n<5; n++)
cout << numbers[n] << "\t ";
return 0;
}

Output

10  20  30  40  50 

GO TO INDEX