Separate pointer conversions from valid calls

An indirect call invokes a function through a pointer expression. Consider these declarations in ISO C, immediately after initialization and before either pointer is reassigned. Which statements correctly describe the pointer expressions and proposed calls? Select all that apply.


C
int twice(int x) { return 2 * x; }
double half(double x) { return x / 2.0; }

typedef int (*Unary)(int);
Unary p = twice;
Unary bad = (Unary)half;
Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Function Pointers Questions: