🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9372

Re: Char vs. Int

#9372
From: Joseph S. D. Yao
Date: Tue, 23 Sep 1986 05:47
21 lines
1380 bytes
In article <3770@brl-smoke.ARPA> jl42@andrew.cmu.edu (Jay Mathew Libove) writes:
>I have always been under the impression that a CHAR variable and an INT variable
>were the same in 'C'- yet I now see:
>In the sequence:
> ...
>char ch is the correct declaration.  ...
>		.  Declaring it 'int' is asking for trouble.
>
>Why is it asking for trouble to declare ch as INT when K&R says they are the
>same?

Simple.  It doesn't and they aren't.  K&R 2.2: char is a byte, one
character; int is the machine's natural integer (and examples).
K&R 2.7 mentions chars' automatic conversion, in arithmetic and
arguments, into ints.  (The need for conversion, of course, implies
the difference between the two.)  This is repeated in CRef 2.6,
4., 6.1, 6.6.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}
			jsdy@hadron.COM (not yet domainised)
Technical Details
Message-ID: <576@hadron.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rlgvax!hadron!jsdy
References: <3770@brl-smoke.ARPA>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rlgvax!hadron!jsdy
From: jsdy@hadron.UUCP (Joseph S. D. Yao)
Newsgroups: net.lang.c
Subject: Re: Char vs. Int
Message-ID: <576@hadron.UUCP>
Date: Tue, 23-Sep-86 01:47:24 EDT
Article-I.D.: hadron.576
Posted: Tue Sep 23 01:47:24 1986
Date-Received: Tue, 23-Sep-86 22:20:01 EDT
References: <3770@brl-smoke.ARPA>
Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao)
Organization: Hadron, Inc., Fairfax, VA
Lines: 21
Summary: NOT same.