recategorized by
4,201 views
2 votes
2 votes

Consider the following two function declarations:

int *f()

int (*f)()

Which of the following is true?

  1. Both are identical
  2. The first is a correct declaration and the second is wrong
  3. Both are different ways of declaring pointer to a function
  4. The first declaration is a function returning a pointer to an integer and the second is a pointer to function returning integer
recategorized by

1 Answer

1 votes
1 votes
ans is D

int *f( ) is a function returning a pointer to an integer  (here priority of () is more than * so it written first

int (*f)() here since both are braces so we will proceed from left to right so it is pointer to function returning integer
Answer:

Related questions

2 votes
2 votes
1 answer
2
go_editor asked Jul 24, 2016
8,221 views
What is the output of the following program?#include<stdio.h main() { int a, b =0; static int c[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; for (a=0; a<10; ++a) int ((c[a]%2)==0)...