Go Back   Velocity Reviews > Newsgroups > C Programming
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

C Programming - whats the use of unsigned char

 
Thread Tools Search this Thread
Old 11-06-2009, 05:47 PM   #11
Default Re: whats the use of unsigned char


Seebs <usenet-> writes:
> On 2009-11-06, arnuld <> wrote:

[...]
>> char a = 'A';

[...]
>> and hence /char a/ will actually be stored as number 65, not as 'A'.

>
> Right.


Only half right.

Assuming an ASCII-based system (that includes any of the numerous
character sets derived from ASCII), the value stored in a can be
written either as 65 or as 'A'. Both expressions have the same value
and type (yes, character constants in C are of type int, for
historical reasons).

The value stored in a is a number, more specifically an integer. That
value is written as 65. It can also be written as 'A'.

The value stored in any char object is a small integer. Such a value
is often *used* to represent a character value, but it needn't be.

--
Keith Thompson (The_Other_Keith) kst- <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


Keith Thompson
  Reply With Quote
Old 11-06-2009, 05:48 PM   #12
Seebs
 
Posts: n/a
Default Re: whats the use of unsigned char
On 2009-11-06, Keith Thompson <kst-> wrote:
> Only half right.


Yeah. I was trying to agree that so far as C is concerned, it's just a 65,
it doesn't matter whether or not that happens to match a particular letter.

The OP's confusion was apparently contagious, though.

-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!


Seebs
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
unsigned code =?Utf-8?B?S2VudA==?= Windows 64bit 2 09-26-2007 03:24 PM
vista 64 - Unsigned drivers BENAGLIA Windows 64bit 8 09-10-2007 05:44 PM
signed & unsigned drivers? Kue2 Windows 64bit 2 09-01-2007 01:05 AM
How do You stop Vista from Blocking unsigned drivers Kue2 Windows 64bit 16 01-30-2007 08:20 AM
Windows Vista Unsigned Drivers mcbacon@gmail.com Windows 64bit 1 12-11-2006 11:50 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46