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

Joined
Jul 30, 2010
Messages
1
Reaction score
0
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top