More problems with passing functions as arguments.

Jerry J. Anderson jerry at matt.ksu.ksu.edu
Thu Mar 21 21:40:06 AEST 1991


In article <27546 at uflorida.cis.ufl.EDU> pm0 at reef.cis.ufl.edu (Patrick Martin) writes:

[original code deleted]

>This code works fine when compiled with gcc or my compiler at home.
>When compiled with some of the older implementations of C it fails.
>
>Is there a way I can get this to run with some of the older versions
>of C?

The following compiles under either gcc or cc (non-ANSI).

    void function(i)
        int i;
    {
        printf("\nThe Number Is: %d\n\n",i);
    }
    
    pass_me_a_function(f)
        void (*f)();
    {
        f(1);
    }
    
    main()
    {
        pass_me_a_function(function);
    }

--
"The size of an array is the size of an           Jerry J. Anderson
array; the size of a pointer is the size          Computing Activities
of a pointer."  - Tim Ramsey, under the           Kansas State University
influence of little blue pills.                   Manhattan  KS  66506



More information about the Comp.lang.c mailing list