Parsing Integer to String C

前端 未结 9 987
情深已故
情深已故 2020-12-14 08:58

How does one parse an integer to string(char* || char[]) in C? Is there an equivalent to the Integer.parseInt(String) method from Java in C?

9条回答
  •  悲&欢浪女
    2020-12-14 09:02

    If you want to convert an integer to string, try the function snprintf().

    If you want to convert a string to an integer, try the function sscanf() or atoi() or atol().

提交回复
热议问题