Course


Data types

Learn about basic data types such as int, float, char etc. in C programming.

Basic types in C

A table containing commonly used types in C programming for quick access.

Type Size (bytes) Format Specifier
int at least 2, usually 4 %d, %i
char 1 %c
float 4 %f
double 8 %lf
short int 2 usually %hd
unsigned int at least 2, usually 4 %u
long int at least 4, usually 8 %ld, %li
long long int at least 8 %lld, %lli
unsigned long int at least 4 %lu
unsigned long long int at least 8 %llu
signed char 1 %c
unsigned char 1 %c
long double at least 10, usually 12 or 16 %Lf

You can always check the size of a variable using the sizeof() operator.

C (GCC 9.2.0)
  • Input  

Derived Data Types

Data types that are derived from fundamental data types are derived types. For example: arrays, pointers, function types, structures, etc. We will learn about these derived data types in later tutorials.