Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: how do I initialize a function pointer to be NULL ? Message-ID: <6440@brl-smoke.ARPA> Date: Sun, 20-Sep-87 20:28:59 EDT Article-I.D.: brl-smok.6440 Posted: Sun Sep 20 20:28:59 1987 Date-Received: Mon, 21-Sep-87 00:38:33 EDT References: <197@tiger.Princeton.EDU> <27742@sun.uucp> <2236@emory.uucp> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 Keywords: NULLFUNC NULL #define NULL 0 /* universally correct */ Just don't attempt to pass this as a parameter to a function without supplying the proper cast. func( stuff, (int (*)())NULL ); /* for example */ If you make extensive usage of such parameters, then it might save some typing to define shorthand such as #define NULL_DIRENTP ((struct dirent *)0) This would be particularly useful if the type involved might change in a future revision of the code. Ignore all babble about defining NULL as 0L etc.