#include<stdio.h>
char* my_atoi(int num, char* str) {
int i = 0;
do {
int rem = num % 10;
str[i++] = rem + '0'; // 直接将余数转换为字符'0'到'9'
} while (num /= 10);
// 直接将余数转换为字符'0'到'9'
str[i] = '\0'; // 添加字符串结束符
return str;
}
int main() {
int a = 123;
char arr[4] = { 0 };
printf("%s", my_atoi(a, arr));
}