pointer to a function

A

alice

hi all,

Can anybody plz tell me that what is the return type of the function

to which ptf points in the following definition:

#define (*ptf())

Thanks.
 
M

Merrill & Michele

"Joona I Palaste"




The above code is invalid. The C preprocessor is a simple, "stupid",
token-by-token replacer. It can't handle the C type system syntax.
Therefore your whole question becomes meaningless.

Mr. Palaste is correct. I sometimes think that advanced developers can't
quite see what we learners are getting at, but that code snippet is DOA to
my eye as well. If you follow up, I suggest you #define plz please . MPJ
 
J

Jack Klein

hi all,

Can anybody plz tell me that what is the return type of the function

to which ptf points in the following definition:

#define (*ptf())

Thanks.

The macro does not define anything, in fact it is a syntax error.

Now if you replace it with this:

typedef (*ptf)();

....then under older versions of the C standard, ptf would point to a
function returning an int. Since the 1999 revision of the C standard,
my example is illegal as all declarators must contain a type. This
would need to be:

typedef int (*ptf)();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,404
Latest member
PerryRutt

Latest Threads

Top