All Exams Test series for 1 year @ ₹349 only
Question

The following statement in ‘C’
int (*f())[ ];
declares

The correct answer is
a function returning a pointer to an array of integers.

Interpreting C Declaration: $int (*f())[ ];$

To understand the declaration $int (*f())[ ];$, we break it down based on C's declaration rules (right-left parsing):

  • $f()$: This indicates that $f$ is a function.
  • $(*f())$: The parentheses around $*f$ bind the dereference operator $*$ to the result of the function call $f()$. This means $f$ returns a pointer.
  • $(*f())[...]$: The square brackets $[...]$ indicate an array. The type specified is $int$.
  • $int (*f())[ ]$: Combining these, the declaration signifies that $f$ is a function that returns a pointer to an array of integers. The empty brackets $[ ]$ signify that the size of the array is not specified in this declaration, which is permissible for the return type of a function when dealing with pointers to arrays.

Therefore, the statement declares a function returning a pointer to an array of integers.

Was this answer helpful?

Important Questions from Pointer

  1. Consider the following C program:
    #include <stdio.h>
    void stringcopy(char *, char *);
    int main(){
    char a[30] = "@#Hello World!";
    stringcopy(a, a + 2);
    printf("%s\n", a);
    return 0;
    }
    void stringcopy(char *s, char *t) {
    while(*t)
    *s++ = *t++;
    }
    Which ONE of the following will be the output of the program?

  2. Consider the following C program:
    #include <stdio.h>
    int main(){
    int a;
    int arr[5] = {30,50,10};
    int *ptr;
    ptr = & arr[0] + 1;
    a = *ptr;
    (*ptr)++;
    ptr++;
    printf("%d", a + (*ptr) + arr[1]);
    return 0;
    }
    The output of the above program is ____________ (Answer in integer)

  3. Consider the following ANSI-C program.

    #include <stdio.h>
    int main(){
     int *ptr, a, b, c;
     a=5; b=11; c=20;
     ptr=&a; *ptr=c; ptr=&c;
     a=*(&b); c=*ptr-a;
     printf("%d",c);
     return(0);
    }

    The output of this program is ____________. (answer in integer)

    Note: Assume that the program compiles and runs successfully.

  4. What is the output of the following C programming language code? 

    #include<stdio.h>

     int main()

    { 

    int x = 10;

     int *p = &x;

     *p = *p + 5;

     printf("%d %d", x, *p); 

    return 0; 

    }

  5. What would be the equivalent pointer expression for referring the array element ar[m][n][o]
Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App