Data types: int, float, char, etc.

Home / C Programming / Data types: int, float, char, etc.

Data types: int, float, char, etc.


In C programming, data types define the type of data that can be stored in variables or constants. Here are some commonly used data types in C:

int: Used to store integers (whole numbers) with a specific range. The range of values depends on the system but typically ranges from -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 on most systems.

float: Used to store single-precision floating-point numbers, which are numbers with a fractional part. Floating-point numbers have a limited precision and can represent numbers with decimal points.


double: Used to store double-precision floating-point numbers, which have higher precision than float. The range and precision of double are greater than float.

char: Used to store individual characters. A char variable occupies 1 byte of memory and can hold a single character from the ASCII character set.

_Bool: Used to store boolean values. It can hold either true or false. The value 0 represents false, and any non-zero value represents true.