473,385 Members | 1,927 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Unsigned and signed char types

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.

Nov 14 '05 #1
4 1568
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

Nov 14 '05 #2
"Emmanuel Delahaye" <em***@YOURBRAnoos.fr> writes:
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.
--
Ben Pfaff
email: bl*@cs.stanford.edu
web: http://benpfaff.org
Nov 14 '05 #3
On Sun, 12 Jun 2005 20:11:39 +0200, Emmanuel Delahaye wrote:
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.


As such they are like other signed and unsigned integer types.
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.


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

Nov 14 '05 #4
Sriniv <sr*******@gmail.com> wrote:
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
Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: MiniDisc_2k2 | last post by:
Okay, here's a question about the standard. What does it say about unsigned/signed mismatches in a comparison statement: char a = 3; unsigned char b = 255; if (a<b) Now what's the real...
3
by: Siemel Naran | last post by:
Hi. Is there a way to convert the type signed int to the type unsigned int, char to unsigned char, signed char to unsigned char, and so on for all the fundamental integer types? Something like ...
9
by: dam_fool_2003 | last post by:
For int data type the default range starts from signed to unsigned. If we don't want negative value we can force an unsigned value. The same goes for long also. But I don't understand why we have...
10
by: tinesan | last post by:
Hello fellow C programmers, I'm just learning to program with C, and I'm wondering what the difference between signed and unsigned char is. To me there seems to be no difference, and the...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
22
by: juanitofoo | last post by:
Hello, I've just switched to gcc 4 and I came across a bunch of warnings that I can't fix. Example: #include <stdio.h> int main() { signed char *p = "Hola";
4
by: ravinderthakur | last post by:
hi all experts, can anybody explain me the difference between the unsigned char and char in c/c++ langugage. specifically how does this affects the c library fucntion such as strcat,strtok...
7
by: somenath | last post by:
Hi All, I am trying to undestand "Type Conversions" from K&R book.I am not able to understand the bellow mentioned text "Conversion rules are more complicated when unsigned operands are...
6
by: Kislay | last post by:
Consider the following code snippet unsigned int i=10; int j= - 2; // minus 2 if(i>j) cout<<"i is greater"; else cout<<"j is greater"; Since i is unsigned , j is greater . I know why , but...
15
by: Andreas Eibach | last post by:
.... but I have an unsigned long value in the printf. This warning came when I used gcc 4.x to compile. .... unsigned long offset = 0; .... Well OK, an "easy" way would be instead of printf...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.