What is the significance of 0.0f when initializing (in C)?

c

Solution

float x = 0 has an implicit typecast from int to float. float x = 0.0f does not have such a typecast. float x = 0.0 has an implicit typecast from double to float.

Depending on the compiler, implicit typecast can require the compiler to generate extra code.

Problem

I've seen code where people initialize float variables like this: ``` float num = 0.0f; ``` Is there a significant difference between this and just doing the following below? ``` float num = 0; ``` Thanks.. :)

Original source

Related problems