I don't understand how the test function works.even if the argument list doesn't enough for three, it still output the first calling's third parameter.
That was not the problem,I mean that after the first calling, it works well ,and it prints Test1 Test2 Test3, and then I try to make some change ,I intended to make the arg_num to be 3; and it prints Test4 Test5 Test3,Test4 and Test5 seems to be reasonable, but why Test3? it seems that va_list is static.
You are using the same area of the stack for the second call as the first. The function blindly grabs the next available string to print.
If you call with test(3,"Some longer string","Another Long string"); you will get a different third string (or a crash, or some other undefined behaviour).
That would come under 'some other undefined behaviour'. ;0)
The point is we can't tell you why it is doing what it is doing because the standard does not say what should happen in this case so the compiler implementors do what they think is best. I put your code into VS2010 and got '(null)' as the third string.