How to use #define to use puts() and __VA_ARGS__ in C

1 Answer

0 votes
#include <stdio.h>
 
#define showargs(...) puts(#__VA_ARGS__)
 
int main(void)
{
    showargs();            
    showargs(3, "a", "abc", int); 
    
    return 0;
}

 
/*
run:

3, "a", "abc", int

*/

 



answered Aug 23, 2016 by avibootz

Related questions

1 answer 169 views
1 answer 143 views
2 answers 142 views
142 views asked Feb 9, 2023 by avibootz
1 answer 189 views
1 answer 181 views
1 answer 152 views
152 views asked Jun 6, 2023 by avibootz
1 answer 254 views
...