void int_to_str(int num, char *str)
{ char c;
int i=0;
while (num != 0)
{ str[i] = num%10 + '0';
num /= 10;
i++;
}
str[i] = '\0';
for (int j = 0; j < i/2; j++)
{ c = str[j];
str[j] = str[i-j-1];
str[i-j-1] = c;
}
}
答案是这样。但是运行结果不知道为什么还是整型。
拉丁的传说
相关分类