Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > VA_START called inside a function with fixed number of arguments (#2)

Reply
Thread Tools

VA_START called inside a function with fixed number of arguments (#2)

 
 
tukki tukki is offline
Junior Member
Join Date: Jul 2010
Posts: 1
 
      07-30-2010
Hello i read the last post about the same problem but wasnt able to figure out a solution as i didnt understand much. My problem goes like this:
This is the program i am trying to run:

#include"stdarg.h"
main()
{
int max;
max=findmax(5,23,15,1,92,50);
printf("%dMAX=",max);

max=findmax(5,4,7,8,99);
printf("\n%dMAX=",max);
}

findmax(int tot_num)
{
int max,count,num;
va_list ptr;
va_start(ptr,tot_num);
max=va_arg(ptr,int);
for(count=1;count<tot_num;count++)
{
num=va_arg(ptr,int);
if(num>max)
max=num;
}
return(max);
}

i am using dev c++ and it gives me the error on compilation "va_start called inside a function with fixed number of arguments ".


Kindly guide me...
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable number of arguments for methods called with "send" Pierre Lecocq Ruby 2 04-27-2010 02:23 PM
Call again a variadic function (... variable number of arguments)with same arguments that its variadic wrapper moreau.steve@gmail.com C Programming 3 12-31-2008 07:13 AM
how to pass a function name and its arguments inside the arguments of other function? jmborr Python 1 11-03-2007 08:20 AM
VA_START called inside a function with fixed number of arguments mahesha C++ 3 10-05-2006 10:42 PM
Why va_start takes 2 arguments Minti C Programming 1 09-03-2004 06:39 PM



Advertisments