写一个函数,输入一个整数,如何将其转换为字符串

比如输入了98,函数返回“98”。怎么做到?我知道怎么输出带双引号的,但是我不知道怎么转成字符串

include # include void main (void); void main (void) { int num = 100; char str[25]; itoa(num, str, 10); printf("The number 'num' is %d and the string 'str' is %s. \n" , num, str); }

#include"stdio.h"
#include"math.h"


int main()
{
    int input = 0;
    char str[105];
    char inorder[105];
    int index = 0;
    while(scanf("%d", &input)){
        index = 0;
        while(input > 0){
            int tmp = 0;
            tmp = input % 10;
            str[index] = (char)(tmp+48);
            index ++;
            input /= 10;
        }
        for(int i=0;i<index;i++){
            inorder[i] = str[index-i-1];
        }
        printf("%s\n", inorder);
    }
    return 0;
}

兄dei,你inorder忘记写结尾的'\0'了