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 thefloat
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. Related Questions on C Fundamentals
What is the primary purpose of a function prototype in C?
A. Declare a variable
B. Declare a function
C. Define a function
D. Assign a value
What is the correct syntax for declaring a variable in C?
A. int variable_name;
B. variable_name = 5;
C. variable_name int;
D. int = variable_name;
Join The Discussion