about signed chars

G

Giannis Papadopoulos

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.
 
R

Richard Heathfield

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.
 
M

Michael Mair

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
 
M

Malcolm

Richard Heathfield said:
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.
 
C

Chris Hills

Richard said:
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.
 

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
474,169
Messages
2,570,918
Members
47,458
Latest member
Chris#

Latest Threads

Top