In C, integers and floating-point numbers are both used to store numerical data, but they differ in the type of numbers they can represent. An integer is a data type used to store whole numbers, both positive and negative, without any fractional part (e.g., -1
, 0
, 100
). The int
data type in C is typically used to store integers. A floating-point number, on the other hand, is used to represent numbers that have a fractional component, such as decimals (e.g., 3.14
, -0.001
, 2.5
). The data types float
and double
in C are used to store floating-point numbers, with double
offering higher precision than float
. The key difference is that integers store whole numbers, while floating-point numbers store real numbers with decimals.