| I l @ ve RuBoard |
sizeof
yields the size, in units the
(type)
is the cast operator and converts the following value to the type specified by the
,
is the comma operator; it links two expressions into one and
for (step = 2, fargo = 0; fargo < 1000; step *= 2)
fargo += step;
| I l @ ve RuBoard |
| I l @ ve RuBoard |
Summary: The Basic Data Types
Summary: How to Declare a Simple Variable
Summary: Qualifiers
| I l @ ve RuBoard |
| I l @ ve RuBoard |
C's basic types fall into two categories: integers and floating-point
The basic data types are set up using the following eight keywords: int , long , short , unsigned , char , float , double , and signed (ANSI C).
Signed integers can have positive or negative values.
int is the basic integer type for a given system.
long or long int can hold an integer at least as large as the largest int and possibly larger; long is at least 32 bits.
The largest short or short int integer is no larger than the largest int , and may be smaller. A short is at least 16 bits. Typically, long is bigger than short , and int is the same as one of the two. For example, C DOS compilers for the PC provide 16-bit short and int and 32-bit long . It all depends on the system.
The long long type provided by the C9X committee is at least as big as long and is at least 64 bits.
Unsigned integers have zero or positive values only, which extends the range of the largest possible positive number. Use the keyword unsigned before the desired type: unsigned int , unsigned long , unsigned short , or unsigned long long . A lone unsigned is the same as unsigned int .
Characters are typographic symbols such as
A
,
&
, and
+
. By definition, one byte of memory is used for a
char
variable. In the past, 8 bits has been the most typical
char is the keyword for this type.
Some
Floating-point numbers can have positive or negative values.
float is the basic floating-point type for the system. It can represent at least six significant digits accurately. Typically, float uses 32 bits. double is a (possibly) larger unit for holding floating-point numbers. It may allow more significant figures and perhaps larger exponents than float . It can represent at least ten significant digits accurately. Typically, double uses 64 bits. long double is a (possibly) even larger unit for holding floating-point numbers. It may allow more significant figures and perhaps larger exponents than double .
| I l @ ve RuBoard |