As far as I know,
"int" means "signed int",
"long" means "signed long int" etc.
Is this true for char as well?
PS type "long long" is in C99 standard right?
--
Giannis Papadopoulos
http://dop.users.uth.gr/
University of Thessaly
Computer & Communications Engineering dept.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Papadopoulos Giannis wrote:
> As far as I know,
>
> "int" means "signed int",
> "long" means "signed long int" etc.
Yes.
>
> Is this true for char as well?
No. Whether `char' is signed or unsigned is platform-dependent.
>
> PS type "long long" is in C99 standard right?
>
Right.
HTH,
--ag
--
Artie Gold -- Austin, Texas
"Yeah. It's an urban legend. But it's a *great* urban legend!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Papadopoulos Giannis" <ipapadop@inf.uth.gr> wrote in message news:c2qu5l$1r7s$3@ulysses.noc.ntua.gr...
> As far as I know,
>
> "int" means "signed int",
> "long" means "signed long int" etc.
>
Yes.
> Is this true for char as well?
May be, or may not be. To find out if the signed'ness of char, use the
following program:
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int
main ( void )
{
if ( 0 == CHAR_MIN )
puts ( "Unsigned char" );
else
if ( CHAR_MIN == SCHAR_MIN )
puts ( "Signed char" );
return EXIT_SUCCESS;
}
>
> PS type "long long" is in C99 standard right?
>
Yes. It's 64 bits.
--
Vijay Kumar R Zanvar
Movies - http://www.geocities.com/vijoeyz/misc/movies.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Fri, 12 Mar 2004 09:54:57 +0530, "Vijay Kumar R Zanvar"
<vijoeyz@hotpop.com> wrote in comp.lang.c:
>
> "Papadopoulos Giannis" <ipapadop@inf.uth.gr> wrote in message news:c2qu5l$1r7s$3@ulysses.noc.ntua.gr...
> > As far as I know,
> >
> > "int" means "signed int",
> > "long" means "signed long int" etc.
> >
>
> Yes.
>
> > Is this true for char as well?
>
> May be, or may not be. To find out if the signed'ness of char, use the
> following program:
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <limits.h>
>
> int
> main ( void )
> {
> if ( 0 == CHAR_MIN )
> puts ( "Unsigned char" );
> else
> if ( CHAR_MIN == SCHAR_MIN )
> puts ( "Signed char" );
>
> return EXIT_SUCCESS;
> }
>
> >
> > PS type "long long" is in C99 standard right?
> >
>
> Yes. It's 64 bits.
I think you mean _at least_ 64 bits.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Fri, 12 Mar 2004 09:54:57 +0530, "Vijay Kumar R Zanvar"
<vijoeyz@hotpop.com> wrote:
>
>"Papadopoulos Giannis" <ipapadop@inf.uth.gr> wrote in message news:c2qu5l$1r7s$3@ulysses.noc.ntua.gr...
>> As far as I know,
>>
>> "int" means "signed int",
>> "long" means "signed long int" etc.
>>
>
>Yes.
>
>> Is this true for char as well?
>
>May be, or may not be. To find out if the signed'ness of char, use the
>following program:
>
>#include <stdio.h>
>#include <stdlib.h>
>#include <limits.h>
>
>int
>main ( void )
>{
> if ( 0 == CHAR_MIN )
> puts ( "Unsigned char" );
> else
> if ( CHAR_MIN == SCHAR_MIN )
> puts ( "Signed char" );
>
> return EXIT_SUCCESS;
>}
>
That's handy...and it seems you can do without the entire 2nd "if" line.
-leor
Leor Zolman
BD Software
leor@bdsoft.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Leor Zolman" <leor@bdsoft.com> wrote in message news:dnf250hhd6gesjg7ds57tsme6vivd31i1u@4ax.com...
> On Fri, 12 Mar 2004 09:54:57 +0530, "Vijay Kumar R Zanvar"
> <vijoeyz@hotpop.com> wrote:
>
> >
> >"Papadopoulos Giannis" <ipapadop@inf.uth.gr> wrote in message news:c2qu5l$1r7s$3@ulysses.noc.ntua.gr...
> >> As far as I know,
> >>
> >> "int" means "signed int",
> >> "long" means "signed long int" etc.
> >>
> >
> >Yes.
> >
> >> Is this true for char as well?
> >
> >May be, or may not be. To find out if the signed'ness of char, use the
> >following program:
> >
> >#include <stdio.h>
> >#include <stdlib.h>
> >#include <limits.h>
> >
> >int
> >main ( void )
> >{
> > if ( 0 == CHAR_MIN )
> > puts ( "Unsigned char" );
> > else
> > if ( CHAR_MIN == SCHAR_MIN )
> > puts ( "Signed char" );
> >
> > return EXIT_SUCCESS;
> >}
> >
>
> That's handy...and it seems you can do without the entire 2nd "if" line.
> -leor
Always. Here it is:
(void)puts ( CHAR_MIN == (char)0 ? "Unsigned char" : "Signed char" );
>
> Leor Zolman
> BD Software
> leor@bdsoft.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Leor Zolman wrote:
> <vijoeyz@hotpop.com> wrote:
>
... snip ...
> >
> >#include <stdio.h>
> >#include <stdlib.h>
> >#include <limits.h>
> >
> >int
> >main ( void )
> >{
> > if ( 0 == CHAR_MIN )
> > puts ( "Unsigned char" );
> > else
> > if ( CHAR_MIN == SCHAR_MIN )
> > puts ( "Signed char" );
> >
> > return EXIT_SUCCESS;
> >}
>
> That's handy...and it seems you can do without the entire 2nd "if" line.
In the interests of fighting code and source bloat:
#include <stdio.h>
#include <limits.h>
int main(void)
{
if (0 == CHAR_MIN) fputs("Un", stdout);
puts("Signed char");
return 0;
}
<silly grin>
--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
<http://cbfalconer.home.att.net> USE worldnet address!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~