given a function with a variable number of parameters…
void function(int count,...)
{
...
}
how do i differentiate between pointers and data variables…
given i don’t know the types beforehand.
i.e
char *p=new char();
*p='v';
function(2,5,p);
how to know if p is a pointer so that it can be handled that way inside the function…
i.e if it were a pointer i would use *p else only p etc.
the function to be designed is thus going to be a general function,taking pointers and data ..
any type of answer is acceptable..
thank you in advance…
This is not possible using variable arguments. The type of the arguments must be known when calling va_arg.
One possible way to do this is pass pointers to self describing data like variants.