search
Log In
2 votes
863 views

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
in Programming and DS
recategorized by
863 views

1 Answer

1 vote
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

3 votes
0 answers
1
362 views
Consider the following sequence of operations: Pointer p1 is set to point at a new heap-dynamic variable. Pointer p2 is assigned p1's value The heap dynamic variable pointed to by p1 is explicitly de-allocated but p2 is not changed by the operation This situation ... dangling pointer p2 becomes a dangling pointer Both p1 and p2 are now dangling pointers Neither p1 nor p2 is now a dangling pointer
asked Jul 24, 2016 in Programming and DS jothee 362 views
2 votes
1 answer
2
1k 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) b+=c[a]; printf(“%d”, b); } 15 25 45 20
asked Jul 24, 2016 in Programming and DS jothee 1k views
2 votes
1 answer
3
1.2k views
Assume that we have constructor functions for both base class and derived class. Now consider the declaration in main() Base *P=New Derived; In what sequence will the constructor be called? Derived class constructor followed by Base class constructor Base class constructor followed by Derived class constructor Base class constructor will not be called Derived class constructor will not be called
asked Jul 8, 2016 in Object Oriented Programming jothee 1.2k views
0 votes
1 answer
4
666 views
A program contains the following declarations and initial assignments. int i=8, j=5; double x =0.005, y=-0.1; char c=&rsquo;c&rsquo;, d=&rsquo;d&rsquo;; Determine the value of the following expressions which involve the use of library functions: abs(1-2*j); log(exp(x)); toupper(d) 2; 0.005; D 1; 0.005; D 2; 0.005; E 1; 0.005; e
asked May 3, 2016 in Programming Sanjay Sharma 666 views
...