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?
-
6https://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list – Oliver Charlesworth Jul 10 '17 at 23:14
-
@may14 Pointer is a derived type that is its type depends on the type of the object it points to. – Vlad from Moscow Jul 10 '17 at 23:15
-
what's difference between double or short – may14 Jul 10 '17 at 23:15
-
1[C Data Types](https://en.wikipedia.org/wiki/C_data_types). – lurker Jul 11 '17 at 00:20
-
1What do you mean by "when to use double or short type **when defining a pointer**"? What does the choice of double or short have to do with defining a pointer? – Jul 11 '17 at 02:13
-
What are you _actually_ trying to achieve? Tell us a bit more. As it stands here the question is unclear. – Jabberwocky Jul 11 '17 at 08:29
1 Answers
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).

- 1,697
- 4
- 20
- 27