Discussion :: Complicated Declarations - General Questions (Q.No.9)
|Sathish said: (Aug 2, 2010)|
|if we put *f in parenthesis it is pointer to function here parenthesis have greater precedence than astrek operator.|
|Prajakta said: (Mar 20, 2014)|
|Trick: here () indicates function(method in java) and * sign is given before () so f is function returning pointer and return type is int so, answer B is correct.|
|Athul M Das said: (Sep 12, 2014)|
|Int *f() is an int pointer but when enclosed in parenthesis int (*f)() it becomes a pointer to a function returning int.|
|Jarvis said: (Dec 1, 2014)|
|OK its cool declaration but can you give an example program so that it'll be more clear?|
|Natwar said: (Jun 30, 2015)|
x = &a;
printf("*x = %d\n",*x);
b = f();
printf("*b = %d\n",b);
|A.Srikanth said: (Dec 16, 2017)|
|No, it is wrong @Natwar.
Please correct in return statement.t return(x) instead of return(*x) and in main() function printf statement printf("*b=%d\n",*b) instead of printf("*b=%d\ n",*b);.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.