Alex Rivera | Logout

Parsing Integer to String C

Asked 2009-01-25T23:38:30.243
22

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?

Edit
Report

2 Answers

49

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().

answered 2009-01-25T23:41:23.933
0

You can try:

int intval;
String stringval;
//assign a value to intval here.
stringval = String(intval);

that should do the trick.

answered 2012-12-10T19:33:58.467

Your Answer