Concept
What primitive types does C support?
ComputerScienceOne / Declaration & Assignment
"The three primary primitive types supported in C are int, double, and char, which support integers, floating point numbers, and single ASCII characters. Integer (int) types are only guaranteed to “be at least” 16 bytes by the C standard but are usually 32-bit signed integers on most modern systems. With a 32-bit signed int we can represent integers in the range −2,147,483,648 to 2,147,483,647. Doubles (double) types are double-precision floating point numbers as per the IEEE 754 standard and provide about 16 digits of precision. C provides a float (single precision floating point number) type and there are various modifiers such as short, long, unsigned and signed that can be used, but these are either system-dependent or rely on later versions of the C standard (such as C99). We will restrict our focus to more portable, interoperable code and stick with the basic int and double types in our code. Finally, the char type is typically a single byte that represents a single ASCII character. For all intents and purposes a char can be treated as an integer in the range 0 to 127 (or 255) as defined by the ASCII text table (see Table 2.4)."
Related Ideas
- What primitive types are available in Java?ComputerScienceOne · Declaration & Assignment
- What are the basic syntax rules of C?ComputerScienceOne · Basic Syntax Rules
- How does C handle arithmetic operators and integer division?ComputerScienceOne · Operators
- How are comparison operators used with characters in C?ComputerScienceOne · Order of Precedence
- How does scanf() read integer, character, and floating-point input in C?ComputerScienceOne · Basic I/O
- How do you declare an enumerated type in C?ComputerScienceOne · Enumerated Types
- How do you use the C standard mathematics library?ComputerScienceOne · Preprocessor Directives
- What types of values does PHP support?ComputerScienceOne · Using Variables