-6

I am writing a C code but am not sure when to use a double or a short type when defining a pointer. Can someone explain the difference between the two?

may14
  • 17
  • 6

1 Answers1

1

From Wikipedia:

Short: Short signed integer type. Capable of containing at least the [−32,767, +32,767] range;[3][4] thus, it is at least 16 bits in size. The negative value is −32767 (not −32768) due to the one's-complement and sign-magnitude representations allowed by the standard, though the two's-complement representation is much more common.

Double: Real floating-point type, usually referred to as a double-precision floating-point type. Actual properties unspecified (except minimum limits), however on most systems this is the IEEE 754 double-precision binary floating-point format. This format is required by the optional Annex F "IEC 60559 floating-point arithmetic".


Something to keep in mind, shorts need to be an integer type (No decimal). Doubles are floating type (With decimal).

Davy M
  • 1,697
  • 4
  • 20
  • 27