levi
Still fresh, damnit!
Code:float f = atof(input);
Why does f need to be a float there if it's only ever going to receive an integer value, if I'm reading it right?
Code:float f = atof(input);
On the one hand: atof() even returns a double, you could simply use atoi() instead if that was the case. On the other hand: it will always end the string after 2 characters behind the '.' and therefore you won't get integers only.Why does f need to be a float there if it's only ever going to receive an integer value, if I'm reading it right?
char input[64];
gets_s(input, 64);
int i = 0;
while(input[i] != '.' && i < 64-1) {
i++;
}
input[i] = 0; //binary 0, Ends the string
int chk=atoi(input);
if chk<10 {
/* TODO: Error */
}
else {
input[i]='.'
double f = atof(input);
}
