I have a print-function:
myprintf("%d ..... other_things_to_print");
-
I call this myprintf() function from many different functions.
-
Suppose function func() calls myprintf() but it has nothing to pass for the “%d” (shown as bold in the myprintf() above).
-
I don’t wanna print zero in place of this “%d”
How can I avoid printing anything in place of “%d” here?
I have tried: ‘\b’, ‘ ‘ — but myprintf() is printing the equivalent integer values for these chars.
Please provide me some hint on this issue.
Thanks.
Best Regards,
Sandeep Singh
If you don’t want to print the
%dwhen no argument was supplied for it, then use anif()-elsestructure inside yourmyprintf()function to not output that position. Here is an example:This is what
if-elseis meant to allow you to do.