LearnFrenzy
Sign in Take a free test

Typedef · typedef MCQ · Question 6

Correct typedef for a function pointer in C Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 6 Back to Exercise

Which typedef defines Op as a pointer to a function taking two ints and returning an int?

  • A typedef int *Op(int, int);
  • B typedef int (*Op)(int, int); Correct
  • C typedef (int *)Op(int, int);
  • D typedef int Op*(int, int);
Correct Answer: Option B

The brackets bind * to the name: "Op is a pointer to a function (int, int) returning int". Without them, int *Op(int, int) would be a function returning int *.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links