Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: [Solved] Need some help getting to my feet Date: Fri, 27 Apr 2018 13:47:19 -0700 Organization: None to speak of Lines: 37 Message-ID: References: <0db1659a-6249-47d0-8fab-baf080d32f76@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="cc0e2a6c7d0567601a378dba59302632"; logging-data="20722"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19T5iXJx1W4rlsO863wltqr" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:lvHcQhx6lVRGpp7HioFW5EDISTk= sha1:95aM9uB1Oi3RSyvt5/I2jL8Jq0Y= Xref: csiph.com comp.lang.c:129873 Dan Purgert writes: > Keith Thompson wrote: [...] >> I think some examples in K&R2 use "implicit int", and as I recall that's >> addressed in the errata. Always declare and define functions with an >> explicit return type. > > So far I haven't run across that, but I'm only in chapter 1 still. > Working through slow / rereading the sections a few times so that it > sticks. You might have run across it without realizing it. The very first example in K&R2 section 1.1 (I'm using the Kindle edition) is: #include main() { printf("hello, world\n"); } The "main()" line is an old-style non-prototype (`main()` should be `main(void)`) *and* it relies on the obsolete "implicit int" rule (it should be preceded with `int`): int main(void) I don't want to imply that this is a huge deal. It's really fairly trivial, and most C compilers will accept the older form without complaint, or at worst with a warning. But you should get into the habit of using the modern form in your own code. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"