How to convert integer value to string in C langauge? | SoloLearn: Learn to code for FREE!

+1

How to convert integer value to string in C langauge?

1/18/2021 4:35:44 PM

Samir Kaushik

5 Answers

New Answer

+3

#include <stdio.h> ... int value = 0; char textvalue[30] = ""; ... snprintf(textvalue, sizeof(textvalue), "%d", value);

+3

Means do you want to convert 1 to '1' Or 1 to 'A' in either case you can make use of the fact that characters are represented by their ASCII values which are integers.

+2

https://www.cplusplus.com/reference/cstdlib/itoa/

+2

Use either snsprintf() or sprintf() https://www.cplusplus.com/reference/cstdio/sprintf/ https://www.cplusplus.com/reference/cstdio/sprintf/

+1

Arsenic 12 to "12" so that i concatenate to some other string