Hey,
if you define function prototype with default value, then you can call function normally when 2 decimal places is needed:
Quote:
char* format(long num, byte maxdec=2){
//...
}
//calling function
a = format(b); //2 decimal places
a = format(b, 1); //1 decimal places
a = format(b, 0); //0 decimal places = integer
|