Click here to Skip to main content
15,904,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
int *f()
int (*f)()
Posted
Comments
Pablo Aliskevicius 22-Feb-12 8:56am    
Is this a homework question? If so, you should mention that.
If not, it would be nice of you to mention how you happened to stumble upon this particular lines of code.
udayday 22-Feb-12 9:03am    
its an interview question..

C
int *f();

f is a function returning a pointer to an integer.

C
int (*f)();

f is a pointer to a function (pointed function returns an integer value).
 
Share this answer
 
The first declares f as a variable of type pointer to int.
The second declares f as a variabvle of type function with no parameters returning an int

P.P.S.: I was wrong, the first is a function declaration, as CPallini pointed out. Explanations can be found at Guru Of The Week #1[^]
 
Share this answer
 
v3
Comments
udayday 22-Feb-12 8:56am    
can u elaborate it please am little slow..
Stefan_Lang 22-Feb-12 9:08am    
I was wrong, CPallini is right. Check his solution or that link:
http://www.gotw.ca/gotw/001.htm
CPallini 22-Feb-12 9:01am    
The first one actually declares a function.
Stefan_Lang 22-Feb-12 9:04am    
Hmm, now that you mention it....
I think I've seen that on gotw, let me check...
Stefan_Lang 22-Feb-12 9:07am    
Ah, found it:
http://www.gotw.ca/gotw/001.htm
I mixed up case 2 and 3 it seems

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900