vendredi 29 juillet 2016
Include First Argument in va_list object
Is it possible to include the first argument of a function within a va_list? I want to pass the arguments from one function to another function.
int main(){
test(1,2,3,4,5,-1);
}
void test(int firstArg, ...){
va_list va;
va_start(va, firstArg);
passFunction(va);
}
void passFunction(va_list va){
int x;
while((x = va_arg(ap,int))!=-1){
cout << x << endl;
}
}
Output I Want:
1
2
3
4
5
Actual Output:
2
3
4
5
Is there any way to achieve this without explicitly passing the first argument to the function?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire