Reputation: 13
What is the differences between,
#define myvariable 1.25
and,
#define myvariable (double)1.25
while declaring a preprocessor directives in C.
Upvotes: 1
Views: 163
Reputation: 881673
The difference is that the preprocessor will, when it sees myvariable
, substitute in (double)1.25
rather than 1.25
.
This will have no effect on your code (possibly bizarre edge cases notwithstanding) since 1.25
is already a double literal, as per C11 6.4.4.2 Floating constants /4
:
An unsuffixed floating constant has type
double
. If suffixed by the letterf
orF
, it has typefloat
. If suffixed by the letterl
orL
, it has typelong double
.
Upvotes: 5