address of function

lvs at ndm20 lvs at ndm20
Tue Mar 18 02:41:00 AEST 1986


>I am a programmer who has just learnt C and has started using it
>to do my programming. I have a question for which I was unable to
>get the answer. I would like to know how to find the address of a
>function in C. I would appreciate any help in this regard from netlanders.
>Thanking all the respondents(C experts).

As defined in K&R, the address of a function may be obtained by referencing
the name of the function without the parens '()', see below.

    int func();

    addr_of_func = func;

This is similar to the fact that the name of an array is it's base address.
Hope this helps.

Larry V. Streepy Jr.                        "Waiting is"
Nathan D. Maier Consulting Engineers

VOICE:  (214)739-4741
Usenet: ...!{allegra|ihnp4}!convex!smu!ndm20!lvs
CSNET:  ndm20!lvs at smu
ARPA:   ndm20!lvs%smu at csnet-relay.ARPA



More information about the Comp.lang.c mailing list