9.how do you write a function that takes a variable number
of arguments? What is the prototype of printf () function?
10.How do you access command-line arguments?
11.what does ‘#include<stdio.h>’ mean?
12.what is the difference between #include<> and #include”…”?
13.what are # pragma staments?
14.what is the most appropriate way to write a
multi-statement macro?

Answers were Sorted based on User's Feedback



9.how do you write a function that takes a variable number of arguments? What is the prototype of p..

Answer / saurabh

WHERE IS THE ANSWER MY FRIENDS?

Is This Answer Correct ?    1 Yes 0 No

9.how do you write a function that takes a variable number of arguments? What is the prototype of p..

Answer / sumati

9. By using default arguments, we can write a function that
takes a variable number of arguments.

10. By default, 2 arguments are passed to main function..
One is the count that contains number of arguments + 1.
1 is for the program name.

Second argument is the array of arguments...with prgram name
at the first index i.e. [0] and the size of array is count-1.

Is This Answer Correct ?    0 Yes 1 No

9.how do you write a function that takes a variable number of arguments? What is the prototype of p..

Answer / deesha

explained how we can utilize the operator ellipsis (…) to
pass variable number of arguments to a function. I have
utilised there the concept of pointers to access the
variable arguments. The standard C Library provides support
to access these arguments. Use for this support
All you need is to know the last argument before the
ellipsis operator(At least one argument is must to use
variable arguments), let’s call it larg

suppose

fun(type var1,type var2,...)

is a function, then larg corresponds to var2

Now we need to declare the list using va_list
i.e.,

va_list al

now initialize it using va_start

va_start(al,larg);

Now to access each argument, we must know the expected type
of the argument

type var_name = va_arg(al,type);

When we have accessed all the variable arguments, we need to
clean up

va_end(al);

Using standard library, we can easily access the variable
arguments

Is This Answer Correct ?    0 Yes 1 No

9.how do you write a function that takes a variable number of arguments? What is the prototype of p..

Answer / 2028

The above reply is an vague idea for the concept idea some
details may be with an example will be an good input from
nay one of us

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

What are the scope of static variables?

0 Answers  


Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers

0 Answers  


C program to read the integer and calculate sum and average using single dimensional array

0 Answers  


Stimulate calculator using Switch-case-default statement for two numbers

0 Answers   Wipro,


What is an arrays?

0 Answers  






write a method for an array in which it can display the largest n next largest value.

1 Answers   Value Labs,


Difference between data structure and data base.

7 Answers   CTS, Value Labs, Zoho,


How can I insert or delete a line (or record) in the middle of a file?

0 Answers  


There is a number and when the last digit is moved to its first position the resultant number will be 50% higher than the original number.Find the number?

1 Answers  


If I have a char * variable pointing to the name of a function ..

0 Answers  


difference between function & structure

9 Answers   Verizon,


Write a program in C to reverse a number by recursive function?

1 Answers  


Categories