unable to understand this typedef

E

Eric Sosman

Sanchit said:
What does this typedef represent?
typedef void Sigfunc(int);

It declares Sigfunc as an alias for "function of one
int argument returning no value."

You can't actually use Sigfunc to define a function:

Sigfunc func ... er, where's my parameter list?
{
... er, how do I refer to the parameters?

... er, what do I return? it looks like I
should return a function, but ...?
}

However, you *can* use it to declare a function:

Sigfunc sig1; /* sig1 is a function ... */
Sigfunc sig2; /* sig2 is a function ... */

And you can use it to describe a function pointer:

Sigfunc *fptr = sig1;
 

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
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top