Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Output of following program?#include<stdio... Start Learning for Free
Output of following program?
#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)
    4  3
  • c)
    3  2
  • d)
    Compiler Error
Correct answer is option 'A'. Can you explain this answer?
Most Upvoted Answer
Output of following program?#include<stdio.h>void dynamic(int s,...
Explanation:

Main Function:
- The main function calls the `dynamic` function twice with different numbers of arguments.

Dynamic Function:
- The `dynamic` function takes an integer `s` and an ellipsis (`...`) representing a variable number of arguments.
- Inside the `dynamic` function, it prints the value of `s`.

Output:
- In the first call to `dynamic(2, 4, 6, 8)`, the integer `s` is 2, so it prints `2`.
- In the second call to `dynamic(3, 6, 9)`, the integer `s` is 3, so it prints `3`.
Therefore, the output of the program is:
2 3
Free Test
Community Answer
Output of following program?#include<stdio.h>void dynamic(int s,...
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.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer?
Question Description
Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer?.
Solutions for Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer?, a detailed solution for Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer? has been provided alongside types of Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Output of following program?#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 3b)4 3c)3 2d)Compiler ErrorCorrect answer is option 'A'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev