Converting int to char* in C/C++
A very common issue we face is to convert an integer into a char pointer or array. This can be achieved using sprintf. int count = 600; unsigned char size[3]; sprintf(size, "%03d", count); Thats it! Here '%03' means that a minimum of 3 characters will be printed and if the number is smaller than that it will be left-padded with 0's.