No, you can't append 0
as prefix to an integer.
An integer starting with 0
is assumed as octal representation of corresponding decimal integer, i.e.:
(037)8 == (31)10
If you really want to save the numbers with prefixed 0
s, you will have to store the numbers as strings.
You can use a temporary string for storing intermediates.
The algorithm will be:
char str[10] = "01"; // To be converted to 001
char temp[10];
strcpy(temp, "0"); // temp = "0", str = "01"
strcat(temp, str); // temp = "001", str = "01"
strcpy(str, temp); // temp = "001", str = "001"