Let’s say you have few functions:
func_1(arg1, arg2, arg3) ,
func_2 (arg1, arg2) and
func_3 (arg1, arg2, arg3).
All 3 performing similar steps:
func (arg1, arg2, arg3)
{
Read line from the file
validate_func()
Store results into arg3
}
So my question is – what would best way to approach this in order to combine these 3 functions into 1?
My thoughts to approach this problem to use function with variable number of arguments (va_start, va_end) . What i’m not sure how to approach is to call appropriate validation function – will it be possible to use in this case function pointer as one of the arguments?Not sure at this point
Any suggestions, links, examples are welcome
Thanks
old_jefrey 0 Newbie Poster
mrnutty 761 Senior Poster
old_jefrey 0 Newbie Poster
mrnutty 761 Senior Poster
old_jefrey 0 Newbie Poster
mrnutty 761 Senior Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
old_jefrey 0 Newbie Poster
old_jefrey 0 Newbie Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.