c++ converting int to char + add leading zeros to char
<p>I got numbers from 0 to 999. How can I achieve the following</p>

<pre><code>int i = 123;//possible values 0-999
char i_char[3] = /*do conversion of int i to char and add 3 leading zeros*/
</code></pre>

<p>Example(s): <code>i_char</code> shall look like <code>"001"</code> for <code>i=1</code>, <code>"011"</code> for <code>i=11</code> or <code>"101"</code> for <code>i=101</code></p>