Monday, September 7, 2015

[C++] scanf thinks a float is double

C++ promotes float as double. 

warning: format ‘%f’ expects argument of type ‘float*’, but argument 2 has type ‘double’ [-Wformat=]
  scanf("%f",rad); // rad is declared as float

So, apply the following fix (it has worked and it should work again):
scanf("%f", &rad)

No comments:

Post a Comment