-4

Is there any difference between an array of pointer to function and an array of function pointers in c. please give an example of each

1

1 Answer 1

2

No, as a function pointer is a pointer to a function.

typedef int (*Pf)(int); /* This defines a type to hold the addrese of int foo(int). */
Pf pfs[42]; /* Declares an array of the above. */

A possible reason for possible irritation is that

pfs[0] = foo;

and

pfs[1] = &foo;

result in the same value for pfs[0] and pfs[1].

Sign up to request clarification or add additional context in comments.

2 Comments

How can I specify the return type of a function that returns an array of function pointers? how can I go about this? Thanks a lot in advance
@Rika: This is worth a separate question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.