cast to float in c code example
Example 1: convert string to float c
char myString = "6.88";
float x = atof(myString);
//x is now 6.88
Example 2: int to float c
float percentage;
percentage = (float)number/total * 100;
char myString = "6.88";
float x = atof(myString);
//x is now 6.88
float percentage;
percentage = (float)number/total * 100;