Re: data types




<koolj96825@xxxxxxxxx> wrote in message
I've been working on this project for the past few months in my spare
time, and now I started working on the windows interface and going
over my petzold book, I've come to the realization that an int could
be 32-bit for PCs. Oh, I could kick myself for not checking good in
the beginning, but the manual for the compiler I am using says int is
16-bit. It may be out of date.

Anyway, now that I need to go back over and look closely at my code,
my question is: is there a way to declare a variable say a 16 bit
unsigned integer in C? Or is declaring it "short" the only specifier
that may work?

What do you wnat a 16 bit unsigned integer for?

Normally you want something to hold an integer that is big enough to never overflow. For instance an image is probably never going to be more than about 10,000 pixels in either dimension. However whether you have 16 or 32 bits to hold the widtha nd height should be a matter of indifference to you.

Occasionally you do need to interface C to other languages, and these things become important. However not as a rule.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

.



Relevant Pages

  • data types
    ... I've been working on this project for the past few months in my spare ... and now I started working on the windows interface and going ... but the manual for the compiler I am using says int is ... is there a way to declare a variable say a 16 bit ...
    (comp.lang.c)
  • Re: data types
    ... and now I started working on the windows interface and going ... For a particular C implementation an int is * CHAR_BIT) ... If your compiler is not a C99 one, as it appears to be, then you'll ... unsigned int is the type you want. ...
    (comp.lang.c)