Connecting Tech Pros Worldwide Help | Site Map

unable to understand this typedef

Sanchit
Guest
 
Posts: n/a
#1: Mar 20 '08
What does this typedef represent?
typedef void Sigfunc(int);



-Sanchit
Eric Sosman
Guest
 
Posts: n/a
#2: Mar 20 '08

re: unable to understand this typedef


Sanchit wrote:
Quote:
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;
Closed Thread