johnfdutcher
Programmer
I have an input file to process written in another language.
One or more fields of (1) byte in length contain digits to be treated as integers.
Simply multiplying the variable name for the field by a constant gives erroneous mathmatical results:
char day_of_week = 7;
int meal_index = 0;
meal_index = 3 * day_of_week;
OR
meal_index = 3 * (int)day_of_week;
Both of the above give 156, where what is desired is 21 ???
One or more fields of (1) byte in length contain digits to be treated as integers.
Simply multiplying the variable name for the field by a constant gives erroneous mathmatical results:
char day_of_week = 7;
int meal_index = 0;
meal_index = 3 * day_of_week;
OR
meal_index = 3 * (int)day_of_week;
Both of the above give 156, where what is desired is 21 ???