How to convert an int to string in C?

后端 未结 10 2193
南方客
南方客 2020-11-22 02:51

How do you convert an int (integer) to a string? I\'m trying to make a function that converts the data of a struct into a string to save it in a fi

10条回答
  •  情书的邮戳
    2020-11-22 03:34

    Use function itoa() to convert an integer to a string

    For example:

    char msg[30];
    int num = 10;
    itoa(num,msg,10);
    

提交回复
热议问题