Home / C Programming / Variable Number of Arguments :: Discussion

Discussion :: Variable Number of Arguments

  1. Point out the error if any in the following program (Turbo C).

     #include 
     #include
     void display(int num, ...); 
    
     int main() 
     {   
        display(4, 'A', 'a', 'b', 'c');     
        return 0;
     } 
     void display(int num, ...) 
     {   
         char c; int j;   
         va_list ptr;     
         va_start(ptr, num);   
         for(j=1; j
             printf("%c", c);  
        } 
    }
    

  2. A.

    Error: unknown variable ptr

    B.

    Error: Lvalue required for parameter

    C.

    No error and print A a b c

    D.

    No error and print 4 A a b c

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    No answer description available for this question.


Be The First To Comment