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...
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...