Q:
         
         
            
               Point out the error, if any, in the following program.
            
                           
                  
#include "stdarg.h"
main()
{
     display ( 4, 12.5, 13.5, 14.5, 44.3);
}
display(int num, ...)
{
       float c; int j;
        va_list ptr;
        va_start (ptr, num);
        for ( j = 1; j <= num; j++)
        {
            c = va_arg ( ptr, float );
            printf ("\n%f", c);
         }
}
               
                      
         
             Answer
                        While extracting a float argument using va_arg we should have useed 
c = va_arg (ptr, double)
          
         
         
         
             View answer
             Workspace
             Report Error
             Discuss