473,387 Members | 1,579 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,387 software developers and data experts.

about signed chars

hai all,
Can any one tell how and where the concept of signed char is
implemented.

Nov 15 '05 #1
8 1199
rn*****@yahoo.com wrote:
hai all,
Can any one tell how and where the concept of signed char is
implemented.


What exactly do you mean?

--
one's freedom stops where other's begin

Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
Nov 15 '05 #2
i mean where should i use signed char

Nov 15 '05 #3
rn*****@yahoo.com wrote:
i mean where should i use signed char


signed char is guaranteed to be able to represent integer values in the
range -127 to +127. If that's all you need, and if you're desperately short
of space, and if ints or short ints are so huge that you simply can't
allocate enough of them for your needs, then you might want to consider
using signed char.

In "normal" C usage, they are generally unnecessary. If you need to store
integer values, use int or long int. If you need to store character data,
use plain old char. If you need to store arbitrary byte values, use
unsigned char.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
mail: rjh at above domain
Nov 15 '05 #4
please elaborate ur sugession

Nov 15 '05 #5
rn*****@yahoo.com wrote:
please elaborate ur sugession


Please quote the message you are replying to or at least the parts
of it you are referring to so that enough context is provided.
Otherwise, nobody can help you if the original message(s) is/are
not on their newsservers (yet) -- and quite a lot of people do not
take kindly to having to search for clues in order to help you.

Also try to write some understandable kind of English.
I guess you asked whoever you answered to "elaborate [his or her]
suggestion" but with the left-out "yo" of "your" one cannot be
sure.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #6
rn*****@yahoo.com wrote:
please elaborate ur sugession


Please elaborate your request.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
mail: rjh at above domain
Nov 15 '05 #7

"Richard Heathfield" <in*****@address.co.uk.invalid> wrote
In "normal" C usage, they are generally unnecessary. If you need to store
integer values, use int or long int. If you need to store character data,
use plain old char. If you need to store arbitrary byte values, use
unsigned char.

The other solution is the bitfield. Most variables are held as members of
structures, and you can specify the exact number of bits you need.
Nov 15 '05 #8
In article <dd**********@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com>, Richard
Heathfield <in*****@address.co.uk.invalid> writes
rn*****@yahoo.com wrote:
i mean where should i use signed char


signed char is guaranteed to be able to represent integer values in the
range -127 to +127. If that's all you need, and if you're desperately short
of space, and if ints or short ints are so huge that you simply can't
allocate enough of them for your needs, then you might want to consider
using signed char.

In "normal" C usage, they are generally unnecessary. If you need to store
integer values, use int or long int. If you need to store character data,
use plain old char. If you need to store arbitrary byte values, use
unsigned char.

The vast majority of MCU in the world are 8 bit systems. These use 8 bit
integer types (signed and unsigned char) unless they need to use a
larger int type.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Nov 15 '05 #9

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...
6
by: Sona | last post by:
Hi, What is the difference between a signed 0x00 (NULL, or 0) and an unsigned 0x00? Can there be one? If I do the following: char var; var = 0x00; what should var hold? and if it was an...
19
by: Christopher Benson-Manica | last post by:
Given signed char str_a="Hello, world!\n"; unsigned char str_b="Hello, world!\n"; what is the difference, if any, between the following two statements? printf( "%s", str_a ); printf( "%s",...
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...
64
by: ng5000 | last post by:
Hi, What's the point of a signed char? As I see it a char represents a character (not an integer, use an int type e.g. short int if you want an 8 bit number, or one of the new types, uint8 I...
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";
6
by: lovecreatesbeauty | last post by:
/* It seems that when an int with width of four bytes is assigned to a one byte width char, the first three bytes from left to right are discarded and the rightest byte is assigned to that char....
9
by: Ioannis Vranos | last post by:
Under C++03: Is it guaranteed that char, unsigned char, signed char have no padding bits?
3
by: darren | last post by:
Hi there Im working on an assignment that has me store data in a buffer to be sent over the network. I'm ignorant about how C++ stores data in an array, and types in general. If i declare an...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.