wu :: forums
« wu :: forums - Function with variable no of arguments! »

Welcome, Guest. Please Login or Register.
Nov 27th, 2024, 9:41pm

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: ThudnBlunder, Icarus, SMQ, william wu, Grimbal, towr, Eigenray)
   Function with variable no of arguments!
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Function with variable no of arguments!  (Read 626 times)
tuxilogy
Newbie
*





   


Posts: 45
Function with variable no of arguments!  
« on: Jun 5th, 2006, 9:44am »
Quote Quote Modify Modify

Hi *
 
The syntax to define a function that can take vairable no of arguments is
 
int try_try(int *, ...); // With three dots esp, because the compiler treats this function can take variable no of arguments.  
 
but during the defination of the this function how we can figure out ; what arguments the user has typed during calling of (try_try() function) in the main() function...
 
Kindly help me in this issue...  
 
TUX
IP Logged
towr
wu::riddles Moderator
Uberpuzzler
*****



Some people are average, some are just mean.

   


Gender: male
Posts: 13730
Re: Function with variable no of arguments!  
« Reply #1 on: Jun 5th, 2006, 2:06pm »
Quote Quote Modify Modify

You need to use "va_start" and "va_list"s
(you should be able to find something googling with that, I'm short on time atm)
 
[edit] http://www-ccs.ucsd.edu/c/stdarg.html [/edit]
« Last Edit: Jun 5th, 2006, 2:41pm by towr » IP Logged

Wikipedia, Google, Mathworld, Integer sequence DB
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board