for(int y = 0; y < 5; y++)
{
char cst1[2] = {info[x+2], info[x+3]};
char cst2[2] = {info[x+5], info[x+6]};
sales[count][atoi(&info[x]) - 1] = atoi(cst1) + atoi(cst2);
x += 8;
}
Every time i do the following code the atoi(cst1) value is multiplied by two then added and atoi(cst2) is multiplied by 100 then added cant figure out why
cst1
and cst2
don't appear to be NUL-terminated.
char cst1[] = {info[x+2], info[x+3], '\0'};
char cst2[] = {info[x+5], info[x+6], '\0'};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.