if (param == NULL) {
diag(outputStr);
This code makes no sense.
if you pass 0 as param, it will just output the string without using a parameter as NULL is defined to 0 by default.
But even if you fix this, you'll always have your %3.0f in the string, as it is always appended, regardless whether you actually want to print a value or not.