-1

so I've been studying pointers, trying to understand them.

I know that in the following line

int f(int ni, int n);

f is a function that accepts two int variables as its input and it returns an int as the result

If I write the following line

int (*f)(int ni, int n);

then f is a function pointer

However, what happens when I write something like?

int (*f[4])(int p);

Thanks for your help.

OMGtechy
  • 7,935
  • 8
  • 48
  • 83
Jack
  • 241
  • 2
  • 14
  • 1
    Use [`cdecl`](http://cdecl.ridiculousfish.com/?q=int+%28*f%5B4%5D%29%28int%29) for pub quiz questions like this. – Kerrek SB Apr 01 '16 at 09:10

2 Answers2

3

This is an array of 4 pointers to function, example:

int foo(int p) {
    return 0;
}

int (*f[4])(int p);
f[0] = foo;
f[1] = foo;
f[2] = foo;
f[3] = foo;
marcinj
  • 48,511
  • 9
  • 79
  • 100
0

refer to this link :

Array functions pointer

There's explainations about what is does and how to implement it

Community
  • 1
  • 1
Aeldred
  • 314
  • 2
  • 15