Basic Data Types Meanings in C

Basic data types and meanings in C programming with type, meaning, constant examples, and printf chars are listed below. You can use the following to work with values.

Basic Data Types Meanings

Type Meaning
int Integer value; that is, a value that contains no decimal point; guaranteed to contain at least 16 bits of precision.
short int Integer value of reduced precision; takes half as much memory as an int on some machines; guaranteed to contain at least 16 bits of precision.
long int Integer value of extended precision; guaranteed to contain at least 32 bits of precision.
long long int Integer value of extraextended precision; guaranteed to contain at least 64 bits of precision.
unsigned int Positive integer value; can store positive values up to twice as large as an int; guaranteed to contain at least 16 bits of precision.
float Floating-point value; that is, a value that can contain decimal places; guaranteed to contain at least six digits of precision.
double Extended accuracy floating-point value; guaranteed to contain at least 10 digits of precision.
long double Extraextended accuracy floating-point value; guaranteed to contain at least 10 digits of precision.
char Single character value; on some systems, sign extension might occur when used in an expression.
unsigned char Same as char, except ensures that sign extension does not occur as a result of integral promotion.
signed char Same as char, except ensures that sign extension does occur as a result of integral promotion.
_Bool Boolean type; large enough to store the values 0 or 1.
float _Complex Complex number.
double _Complex Extended accuracy complex number.
long double _Complex Extraextended accuracy complex number.
void No type; used to ensure that a function that does not return a value is not used as if it does return one, or to explicitly 'discard' the results of an expression, Also used as a generic pointer type (void *).

Basic Data Types

Type Constant Examples printf chars
char 'a', '\n' %c
_Bool 0,1 %i, %u
short int %hi, %hx, %ho
unsigned short int %hu, %hx, %ho
int 12, -97, 0xFFE0, 0177 %i, %x, %o
unsigned int 12u, 100U, 0XFFu %u, %x, %o
long int 12L, -2001, 0xffffL %li, %lx, %lo
unsigned long int 12UL, 100ul, 0xffeeUL %lu, %lx, %lo
long long int 0xe5e5e5e5LL, 500ll %lli, %llx, &llo
unsigned long long int 12ull, 0xffeeULL %llu, %llx, %llo
float 12.34f, 3.1e-5f, 0x1.5p10,0x1P-1 %f, %e, %g, %a
double 12.34, 3.1e-5, 0x.1p3 %f, %e, %g, %a
long double 12.341, 3.1e-5l %Lf, $Le, %Lg