C syntax

romkey%mit-csr at sri-unix.UUCP romkey%mit-csr at sri-unix.UUCP
Fri Aug 26 14:11:34 AEST 1983


From:  John L. Romkey <romkey at mit-csr>

          I believe that the msg about types from Ed Hall had a bug in it. The
second example was an array of pointers to functions returning strings, and
Ed used

char *(p[N])();

as the declaration. But this is actually an array of functions returning
strings, which shouldn't mean much to most C compilers. What you really need
here is another *, as in:

char *(*p[N])();

and when calling one of these functions, you want to say:

          x = *(*p[n])();

I still remember the awful pain of trying to figure out how to declare a
function which returned a pointer to a function which returned an int.

          - John Romkey
            romkey at mit-csr



More information about the Comp.unix.wizards mailing list