Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C | Functions | Question 6

  • Difficulty Level : Basic
  • Last Updated : 28 Jun, 2021

Output of following program?

Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.




#include<stdio.h>
  
void dynamic(int s, ...)
{
    printf("%d ", s);
}
  
int main()
{
    dynamic(2, 4, 6, 8);
    dynamic(3, 6, 9);
    return 0;
}

(A) 2 3
(B) Compiler Error
(C) 4 3
(D) 3 2


Answer: (A)

Explanation: In c three continuous dots is known as ellipsis which is variable number of arguments of function. The values to parameters are assigned one by one. Now the question is how to access other arguments. See this for details.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!