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 157 views
1 answer 127 views
2 answers 129 views
129 views asked Feb 9, 2023 by avibootz
1 answer 178 views
1 answer 166 views
1 answer 139 views
139 views asked Jun 6, 2023 by avibootz
1 answer 238 views
...