+ 1
Why is a suffix needed when declaring non-integer values
When I declare a float, I expect the number to be a float. Why do I need a suffix, to declare a float. float afloat = 1.5; https://code.sololearn.com/c8eJmM9alIlZ
4 Antworten
+ 1
Thanks now I understand.
Because of type safety
You need to define the type of the variable and also the type of the data which is gone be assigned to this variable
since 1.5 is a double
There has to be a way to tell the compiler, the data that is gone be assigned is a float and that is the f
Thanks
0
What does define if a float is a float ?
By defining a float variable, you would expect the input to be a float.
Why would you store by default a double in a float ?
In my opnion the type of a variable is defined by its type definition.