removing leading zero from an LCD

This is the code that converts the int to a string:

itoa(tmpred_value, red_value, 10);

It does an UNFORMATTED conversion.

sprintf(red_value, "%3d  ", tmpred_value);

would do the same thing, except as a FORMATTED conversion.

The part in the quotes is a format specifier. The % defines where a format specifier starts (where a variable's value will be substituted). The d says that the value is an int. The 3 says that we want the resulting value to have a minimum of 3 characters, with leading spaces as required (" 3", " 30", "255", "1023"). The two spaces on the end are copied as-is to the output. So, you will get 5 characters (plus a trailing NULL) in the output - at a minimum.

You can remove the trailing spaces, if you want. They simply ensure that the string is long enough to cover the previous data, in case you are not using a fixed space font.