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

Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1) Quicksort 2) Linear Search 3) Bubble Sort

3 Answers  


what do structure language means?

3 Answers   Microsoft,


10. Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning

5 Answers   Accenture,


which one of follwoing will read a character from keyboard and store in c a)c=getc() b)c=getchar() c)c=getchar(stdin) d)getc(&c) e)none

7 Answers   Trident,


hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm

0 Answers   TCS,






What is sizeof c?

0 Answers  


What is the purpose of main() function?

0 Answers  


why division operator not work in case of float constant?

2 Answers  


CopyBits(x,p,n,y) copy n LSBs from y to x starting LSB at 'p'th position.

9 Answers   Adobe,


Why is main function so important?

0 Answers  


List the variables are used for writing doubly linked list program.

0 Answers   Infosys, Wipro,


what will be the output for the following main() { printf("hi" "hello"); }

5 Answers   RoboSoft,


Categories