ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Do you have a collection of Interview Questions and interested to share with us!!
Please send that collection to along with your userid / name. ThanQ
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
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?
 Question Submitted By :: Avula_sujatha@yahoo.co.in
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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?
Answer
# 1
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 0 No
Sumati
 
  Re: 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?
Answer
# 2
WHERE IS THE ANSWER  MY FRIENDS?
 
Is This Answer Correct ?    0 Yes 0 No
Saurabh
 
 
 
  Re: 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?
Answer
# 3
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 0 No
2028
 
  Re: 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?
Answer
# 4
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 0 No
Deesha
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
write the program for prime numbers? TCS7
11. Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage Accenture5
what is the output of below pgm? void main() { int i=0; if(i) printf("pass"); else printf("fail"); }  2
6. Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod() Accenture1
define function Assurgent4
What are the preprocessors? HP3
O,T,T,F,F,S,S,E,N,?,?,?,T,F,F,S,S,E,N ADP7
difference between semaphores and mutex?  1
True or false: If you continuously increment a variable, it will become negative? 1) True 2) False 3) It depends on the variable type  4
int *a[5] refers to TCS7
how many error occurs in C language ? Wipro9
What is false about the following A compound statement is a.A set of simple statments b.Demarcated on either side by curly brackets c.Can be used in place of simple statement d.A C function is not a compound statement. TCS1
what are the static variables HCL7
who is the founder of c HP7
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language  1
what is the use of #pragma pack, wer it is used?  1
How can I call a function, given its name as a string? ABC-Telecom1
what is the function of .h in #include<stdio.h> in c ? IBM4
WRITE A PROGRAM TO FIND A REVERSE OF TWO NO  5
Difference between fopen() and open()? Aricent1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com