How to get the number of arguments passed to a function?
#1

I am trying to make a function .

In C++, we do like
Suppose
pawn Код:
float avg( int Count, ... )
{
      va_list Numbers;
      va_start(Numbers, Count);
      int Sum = 0;
      for(int i = 0; i < Count; ++i )
            Sum += va_arg(Numbers, int);
      va_end(Numbers);
      return (Sum/Count);
}
What I want is to remove int Count argument. I dont want user to calculate and tell code about the number of arguments.
Any way of doing it?

Also, How do I do it for PAWN.
Reply


Messages In This Thread
How to get the number of arguments passed to a function? - by [MM]RoXoR[FS] - 01.08.2012, 11:51
Re: How to get the number of arguments passed to a function? - by iggy1 - 01.08.2012, 12:17

Forum Jump:


Users browsing this thread: 1 Guest(s)