I have been asked to perform some logic on an integer, which I think would be much more easier if I convert it to String. So please suggest me if there is a simple way other than
using “sprintf” function in C
I have been asked to perform some logic on an integer, which I think
Share
The only better way than
sprintfissnprintf. For simple integer formatting it probably doesn’t matter, butsnprintfwill protect you from disaster if you make a stupid assumption (for example, thatintcan’t be more than 10 digits) or even a reasonable one (likeCHAR_BIT==8)…Couldn’t be much simpler…