Unsigned and signed char types

S

Sriniv

Hello all,
Do we have unsigned and signed char types? If so, i'd like to know the
differences between the two.
And one more question. Is there any provision in C for using the
Unicode character set?
Thank you.
-- Srinivasan.
 
E

Emmanuel Delahaye

Sriniv wrote on 12/06/05 :
Do we have unsigned and signed char types?

Yes, there are 3 char= types:

char : used for strings

signed char
and
unsigned char : used for small integers (mainly in arrays).
If so, i'd like to know the
differences between the two.

For the signed/unsigned types, the difference is the range and the
behaviour on overflow. More details in your C-book.

http://publications.gbdirect.co.uk/c_book/ (C90)
And one more question. Is there any provision in C for using the
Unicode character set?

Yes, the C95 wchar_t type and related w*() functions.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

..sig under repair
 
B

Ben Pfaff

Emmanuel Delahaye said:
Yes, there are 3 char= types:

char : used for strings [...]

It is certainly true that `char' is the type most often used for
strings. However, the C standard doesn't restrict the definition
of "string" to `char' only:

7.1 Introduction
7.1.1 Definitions of terms
1 A string is a contiguous sequence of characters terminated by
and including the first null character.

This may or may not be useful to know outside of comp.lang.c.
 
L

Lawrence Kirby

Sriniv wrote on 12/06/05 :

Yes, there are 3 char= types:

char : used for strings

signed char
and
unsigned char : used for small integers (mainly in arrays).


For the signed/unsigned types, the difference is the range and the
behaviour on overflow. More details in your C-book.

As such they are like other signed and unsigned integer types.
http://publications.gbdirect.co.uk/c_book/ (C90)


Yes, the C95 wchar_t type and related w*() functions.

Even C89 has some wide character support. Note that as with normal
charcters the character encoding is not specified so it need not be
Unicode.

Lawrence
 
W

William Ahern

Sriniv said:
Hello all,
Do we have unsigned and signed char types? If so, i'd like to know the
differences between the two.
And one more question. Is there any provision in C for using the
Unicode character set?

FWIW, Unicode isn't simply a "character set". It's a whole set of rules and
methodologies. C in it's C99 incarnation is about as close to supporting
Unicode as it was when Unix was rewritten in C 30 years ago.

Some will mention wchar_t and the new wide character functions. But wchar_t
gives you absolutely zilch, no matter whether it's 16-bits or 32-bits or
128-bits. The char type suffices just as well, because no matter the width
of the type you _still_ have combining characters, so the whole notion of
mapping a glyph (the things you see on your screen) to a "character" is long
dead, particularly with regards to Unicode.

So, depending on your disposition C either has no support for Unicode, or it
supports it just fine. IOW, you can use libraries like IBM's ICU to deal w/
Unicode. I doubt C will ever have the type of "support" for Unicode like,
for instance, Java has. Though it's worth mentioning that arguably Java got
it wrong. Which is why C will never have that type of support; there's no
single way to do it, and it's quite application specific.

- Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top