Recently, while developing a function to help me create logs to keep track of my program for debugging purposes, I came across a need to specify an undefined amount of parameters so that I can call functions such as CreateLog(“Function Entry: Install”, “Success”, “Remark”, “More Remark”). Therefore, I have searched online to see whether this can be done. To my amazement, this was in fact an easy task. By using the __VA_ARGS__ option and vsprintf function, it can be accomplished. I have yet the time to tidy the codes for this post but at the very least an article to help out.
If you are not sure what I meant by Optional Parameters, see here.