Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ames!pasteur!ucbvax!tut.cis.ohio-state.edu!rutgers!att!chinet!john From: john@chinet.chi.il.us (John Mundt) Newsgroups: comp.lang.c Subject: Re: Typecast of Pointers to Functions Message-ID: <8062@chinet.chi.il.us> Date: 29 Mar 89 15:30:00 GMT References: <7689@killer.Dallas.TX.US> Reply-To: john@chinet.chi.il.us (John Mundt) Distribution: usa Organization: Chinet - Public Access Unix Lines: 28 In article <7689@killer.Dallas.TX.US> brian@killer.DALLAS.TX.US (Brian Pellerin) writes: >I am looking for an equivalent way to specify a typecast of a pointer to >a function other than using typedef. For Example: > > typedef int (*FCN_PTR) (); > FCN_PTR fcn_ptr1; > int (*fcn_ptr2) (); > > fcn_ptr1 = (FCN_PTR) NULL; /* Typecast using typedef */ > fcn_ptr2 = (???????) NULL; /* Do Not Use the typedef. What Goes Here? */ What you need is the following cast fcn_ptr2 = (int (*)()) NULL; If you look at your typedef, you'll see that this is virtually the same thing with the name taken out and with the casting parentheses put around the entire thing. Why not use 0 instead of NULL, too? -- --------------------- John Mundt Teachers' Aide, Inc. P.O. Box 1666 Highland Park, IL john@chinet.chi.il.us (312) 998-5007 (Day voice) || -432-8860 (Answer Mach) && -432-5386 Modem