What is x in the following program? #include <stdio.h> int main(void) {…

2023

What is x in the following program?

#include <stdio.h>

int main(void)

{

typedef int (*(*arrfptr[3])())[10];

arrfptr x;

return 0;

}

  1. A.

    x is pointer

  2. B.

    x is an array of three pointers

  3. C.

    x is an array of three function pointers

  4. D.

    Error in x declaration

Attempted by 204 students.

Show answer & explanation

Correct answer: C

Final answer: x is an array of three function pointers. Each function returns a pointer to an array of 10 int values.

The declaration is typedef int (*(*arrfptr[3])())[10];

Read it from arrfptr outward. arrfptr[3] means an array of three elements. Each element is a pointer to a function. The function return type is int (*)[10], a pointer to an array of 10 integers.

Therefore, arrfptr x; declares x as an array[3] of pointers to functions returning int (*)[10].

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor