In C, which type of variable should be used to store decimal numbers?

In C, which type of variable should be used to store decimal numbers?

a) int
b) float
c) char
d) void

Answer:

b) float

Explanation:

In C, the float data type is used to store decimal (floating-point) numbers. It typically occupies 4 bytes of memory and can represent a wide range of decimal values with single precision. For higher precision, the double data type can be used. The float type is essential for performing arithmetic operations that involve fractional numbers.

Understanding data types like float is crucial for managing different types of numeric data in C programs.

Reference links:

https://www.rameshfadatare.com/learn-c-programming/

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top