🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #25430

Re: LightSpeed C 2.15 putchar???

#25430
From: Clive Steward
Date: Mon, 22 Feb 1988 01:37
29 lines
1156 bytes
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	<stdio.h>
> 
> 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
Technical Details
Message-ID: <6802@drutx.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!burl!codas!mtune!mtgzz!drutx!clive
References: <5267@well.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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