functions returning pointers to functions
Brad Needham
bradn at hammer.UUCP
Wed Dec 14 08:13:37 AEST 1983
I think your confusion comes from the two ways of declaring a function:
1) with other declarations
2) with the function definition (i.e. the code for the function).
Formal parameters do not appear when you declare a function separately
from its definition, e.g.
int *a();
vs
int *a(x)
int x;
{
...
}
If you want a function returning a pointer to a function returning an int,
you can say it two ways:
1) as a declaration:
int (*getroutine())();
2) or as a declaration and definition:
int (*getroutine(name,table))()
char *name;
struct atable *table;
{
...
}
Because the declaration of functions is so confusing, Graham Ross of Tektronix,
MDP wrote a program to convert between English and C declarations. He posted
it to net.sources quite a while ago, but I'm sure he can get a copy to you.
He is tektronix!tekmdp!grahamr.
Brad Needham
Tektronix, ECS.
..decvax!tektronix!tekecs!bradn
More information about the Comp.unix
mailing list