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

Discussion in 'C Programming' started by tukki, Jul 30, 2010.

  1. tukki

    tukki

    Joined:
    Jul 30, 2010
    Messages:
    1
    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...
    tukki, Jul 30, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. frankg
    Replies:
    4
    Views:
    386
    Joe Durusau
    Jul 28, 2003
  2. Minti

    Why va_start takes 2 arguments

    Minti, Sep 3, 2004, in forum: C Programming
    Replies:
    1
    Views:
    355
    Ben Pfaff
    Sep 3, 2004
  3. mahesha
    Replies:
    3
    Views:
    1,852
    Larry Smith
    Oct 5, 2006
  4. jmborr
    Replies:
    1
    Views:
    400
    Stargaming
    Nov 3, 2007
  5. moreau.steve@gmail.com
    Replies:
    3
    Views:
    805
    moreau.steve@gmail.com
    Dec 31, 2008
Loading...

Share This Page