[TUHS] v7 K&R C

Adam Thornton athornton at gmail.com
Sat Apr 25 11:59:00 AEST 2020


The C in v7 is, canonically, the language described in K&R, right?

I must be doing something dumb.

I am getting Webb Miller’s “s” editor built there, and I am down to one function.

/* chop_arg - chop a function's argument to a maximum length */
static chop_arg(fcn, arg, maxlen)
int (*fcn)();
int maxlen;
char *arg;
{
    char save;

    save = arg[maxlen];
    arg[maxlen] = '\0';
    fcn(arg);
    arg[maxlen] = save;
}

This doesn’t like the function pointer.

$ cc -c choparg.c
choparg.c:11: Call of non-function

So, uh, what is the obvious thing I am missing?  How am I supposed to be passing function pointers in the C compiler that comes with v7?

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200424/44e48be9/attachment.html>


More information about the TUHS mailing list