I need to do something like :
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#define INCR(count,ARGS...) \
   if(ARGS) \
   count++; \
void main()
{
    int count =1;
    int flag =1;
    INCR(count);
    printf("count %d",count);
    INCR(count,flag); /* flag determines if the count is to be incremented or not */
    printf("count %d",count);
}
I get following errors:
    sh-4.3$ gcc -o main*.c                                                                                                                                              
    main.c: In function 'main':                                                                                                                                          
    main.c:6:8: error: expected expression before ')' token                                                                                                              
     if(ARGS) \                                                                                                                                                          
            ^                                                                                                                                                            
    main.c:15:5: note: in expansion of macro 'INCR'                                                                                                                      
         INCR(count);                                                                                                                                                    
         ^                                                                                                                                                               
    sh-4.3$
Here the counter is supposed to be incremented only if the flag is present. I need a macro with flexible number of arguments. Please help me on this
 
     
     
    