Int and Char
Paul R Markowitz
ecf_eprm at jhunix.UUCP
Thu Jul 24 23:31:56 AEST 1986
Don't C programmers know the difference between a char and an int?
I get these great public domain programs off the net and I spend
the next 2 weeks deciding which variables are declared as char
but really mean short. You see, it's like this. Short, int, and
long are all SIGNED. That means they can take on negative values.
Chars are NOT SIGNED, there is no char called -1. If you want a
variable that takes on negative values, use a short. It certainly
makes your code easier for others to read as well as making it
more portable.
For my next question, why doesn't my C compiler accept declarations
like 'signed char a;' or something like that? It says 'signed undefined'
and dies. Is there no way to make up for the errors of others
and artificially make chars come out signed? I am running sys V rel2
on an att 3b20.
Just had to get this off my chest.
Paul
--
------------------------------------------------------------------------
Paul Markowitz
"A pessimist is someone who won't call on G-d because he is certain he will
get an answering machine."
"Do you wonder if I'm really happy? seismo!umcp-cs!jhunix!ins_aprm
Am I just the company you keep? bitnet: ins_aprm at jhuvms
Which one of us excercises on the old arpanet: ins_aprm%jhunix.BITNET at wiscvm.ARPA
tread mill?
Who hides his head pretending to sleep?"
-Ian Anderson (and Robert Burns?)
More information about the Comp.lang.c
mailing list