Float f suffix Viva-question – Computer Sir Ki Class
  

Login
[lwa]



Solved Problem #JAVA#3880    siteicon   siteicon  

Problem Statement - Float f suffix Viva-question

Why do we add f suffix to a decimal literal number when we initialise a float variable.

Solution

TC++ #3880

Test it !

By default any decimal number like 23.34 would be assumed to be a double number. by adding f suffix like 23.34f we tell the compiler to reserver on 32 bits for the given number as against the use of 64 bits it would have done if we do not add the suffix.


Share

sunmitra| Created: 21-Mar-2018 | Updated: 21-Mar-2018|






Back