C program takes float value as command line argument, so need to format from string to float and then to integer. Using round() from math.h, and then want to cast to int.
Casting by declaring (int) before value, but value type does not change.
Code below:
double *f = (double *) malloc(sizeof(double));
*f = (int)roundf(atof(argv[1]));
printf("Testing f: %d", *f);
make
gives this error message:
format specifies type 'int' but the argument has type 'double'
[-Werror,-Wformat]
printf("Testing f: %d", *f);