Jump to content
  • Advertisement
Sign in to follow this  
badmoon

variable arguement functions (va_list)

This topic is 5458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, consider the following function: void floats( float f, ... ) { float nextf; va_list args; va_start( args, f ); nextf = f; while( nextf ) { printf( "%1.1f ", nextf ); nextf = va_arg( args, float ); } va_end( args ); printf( "\n" ); } When making the following call: floats(1.0f,2.0f,3.0f,0.0f); I would expect to get the following output: 1.0 2.0 3.0 But I don't, I just get: 1.0 Does anyone know why?? Ps. The above code was originally indented but all the tab chars seem to get stripped away! (does anyone know how to add a little text box containing text in your posts?)

Share this post


Link to post
Share on other sites
Advertisement
Thanks doynax, it makes sense now. But how do you include text boxes in your posts? Does anyone how to include pictures?

Share this post


Link to post
Share on other sites
See the Forum Faq for information about how to include images and use the tags available on the boards. The source box tag you're after is [source] and the HTML code to include an image is <img src="http://www.yourdomain.com/yourimage.gif">

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!