Discussion
By default, any real number in 'C' is treated as
Answer: B
Correct answer: A double
An unsuffixed floating constant such as 3.14 has type double in C. To obtain a float the suffix f is required - 3.14f - and L gives a long double.
The default matters in arithmetic: writing float x = 1.0/3.0; performs the division in double precision and only then narrows the result, which is usually what is wanted. It also matters for performance on hardware where single precision is faster, since the double constant forces the whole expression up.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development