Path: utzoo!utgpu!water!watmath!clyde!burl!codas!mtune!mtgzz!drutx!clive From: clive@drutx.ATT.COM (Clive Steward) Newsgroups: comp.sys.mac Subject: Re: LightSpeed C 2.15 putchar??? Message-ID: <6802@drutx.ATT.COM> Date: 22 Feb 88 01:37:47 GMT References: <5267@well.UUCP> Organization: resident visitor Lines: 29 From article <5267@well.UUCP>, by espen@well.UUCP (Peter Espen): > > Why doesn't the following code send a single character to the > stdio window when it is compiled??? > > #include > > main() > { > char c = 'A'; > > > putchar(c); Maybe because putchar () takes an int as a passed parameter, instead of a char? This is the sort of thing that function prototypes (turn that option on in your Lightspeed system) are for. And yes, there are good reasons why putchar takes an int. One wishes consistency, and all operations that return a char to be used, actually return it as an int, so that code (EOF) outside of the range of chars can be used to inform you of unavailability. The manual, or especially reading Kernighan and Ritchie, the C white book, will help. Clive Steward