Getting error: format gibt den Typ 'int' an, aber das Argument hat den Typ 'double'
Ich weiß nicht, warum dies nicht kompiliert wird. Irgendeine Idee
Es ist ziemlich einfach und ich habe es mir ewig angesehen und kann nicht herausfinden, was daran falsch ist.
#include <stdio.h>
#include <stdlib.h>
void euroToDollar(double euro);
int main() {
double europrice1 = 1.00;
euroToDollar(europrice1);
return 0;
}
void euroToDollar(double euro){
double dollar = euro * 1.11;
printf("EUR%.2d = USD%.2d" ,euro, dollar);
return;
}
Die Fehlermeldung:
Basic.c:24:39: error: format specifies type 'int' but the argument has type
'double' [-Werror,-Wformat]
printf("EUR%.2d = USD%.2d" ,euro, dollar);
~~~~ ^~~~~~
%.2f
2 errors generated.