Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: When do you #include ? Message-ID: <7520@brl-smoke.ARPA> Date: 22 Mar 88 18:53:19 GMT References: <4991@sigi.Colorado.EDU> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: na Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 9 In article <4991@sigi.Colorado.EDU> murillo@boulder.Colorado.EDU (Rodrigo Murillo) writes: > printf("foo: %dl",atol(argv[1])); >The prototype for atol() resides in stdlib.h. The above code compiles >without an #include , but the expresion yields rubbish. Naturally, since the compiler assumes that the return type of a function is int if it is invoked with no declaration in scope. Since the correct return type for atol() is long, the default assumption is incorrect and the wrong format of data is passed as an argument to printf().