Implementing formatted print with the possibility to do nothing when it gets no arguments
4 I want to implement a macro named PRINT which gets zero or more parameters, and does the following: If it gets zero parameters - do nothing. If it gets one or more arguments - act like printf. I succeed in implementing it as you can see in my code below, but only at the cost of calling to printf with an empty string in the case we get zero arguments. Is there a way I can handle the zero arguments case without calling to printf (it's not efficient to print something when you just want to do nothing)? #include <stdio.h> #define PRINT(...) printf("" __VA_ARGS__); int main() PRINT(); PRINT("printn"); PRINT("print number: %dn", 7); return 0; output: print print number: 7 c macros printf variadic-functions share | improve this question edited Nov 14 '18 at 10:32 Jabberwocky 27.1k 9 37 72 asked Nov 14 '18 at 10:12 Rodrigo Rodrigo 62 7 2 Where does the empty PRINT() com...