Examveda
Examveda

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

A. char

B. int

C. float

D. double

Answer: Option C

Solution(By Examveda Team)

In C, you can indeed use the float data type to store decimal numbers. However, it's important to note that float is typically used for single-precision floating-point numbers, which have a lower precision and a more limited range compared to double.

So, to clarify:

If you require high precision and a wide range for storing decimal numbers, Option D: double is the more common choice.

Option C: float is a valid choice when you can tolerate slightly lower precision and a somewhat limited range, or when memory constraints are a concern, as float typically requires less memory than double.

In summary, both float and double can be used to store decimal numbers, but the choice between them depends on your specific requirements for precision and range.

This Question Belongs to C Program >> C Fundamentals

Join The Discussion

Related Questions on C Fundamentals