View Single Post
  #3 (permalink)  
Old 08-24-2007, 02:37 AM
velhari velhari is offline
D-Web Programmer
 
Join Date: Mar 2007
Location: Chennai
Posts: 67
velhari is on a distinguished road
Send a message via AIM to velhari
Default Re: Elipsis Operator

Hi connect2Sathya,
Thanks for your reply.... i understood that we can pass as many no of argument to a function which uses elipsis operator.

So, i did my stuff here... but in this i have one problem
let me explain that problem with the following scenario..

I am using that elipsis operator to find out the greatest number.

Code:
#include <stdio.h>
void main()
{
        int greater;
        greater = find_greatest(5,1,9,2,7,4,6,1,0,18,59,37);
        printf("Greatest Number is %d",greater);
}
int find_greatest( val,...)
{
      //my stuff here
}
from here i got a problem. In that above said function find_greatest. I used the elipsis operator and passing multiple arguments from main.

In that function, for doing my stuff to calculate greatest no.. i have to know how many no of argument is passed from called function then only i have to start calculation for to finding the greatest no... for this how can i get the no of parameter is passed from the calling function and how to access that arguments in the calling function.....

Please help me to acheive this....
__________________
Regards,
VELHARI
I am not totally useless. I can be used for a bad example
Reply With Quote