Interview Questions C

C


131. What is command line argument?
Getting the arguments from command prompt in c is known as command line arguments.  In c main function has three arguments.
They are:
Argument counter
Argument vector
Environment vector

132. 133.) void main(){
int x=5,y=10,z=15,val;
val=sum(x,(y=0,z=0,y),z);
clrscr();
printf("%d",val);
getch();
}
sum(intx,inty,int z){
return x+y+z;
}
20

Explanation: In the above program comma after Y=0 &Z=0 are behaving as operator.

133. what is nested structure?
A structure is a collection of one or more variables, possibly of different data types, grouped together under a single name for convenient handling. Structures can contain other structures as members; in other words, structures can nest.

134. What is slack byte in structure?
To store any type of data in structure there is minimum fixed byte which must be reserved by memory. This minimum byte is known as word boundary. Word boundary depends upon machine. TURBO C is based on 8086 microprocessor which has two byte word boundary. So any data type reserves at least two byte space.

135. What is prototype of printf function?
Prototype of printf function is:
intprintf(const char *format ,...)

136. What is difference between declaration and definition?
During declaration we just specify the type and no memory is allocated to the variable. But during the
definition an initial value is assigned and memory is allocated to the variable.

137. What is function recursion?
When a function of body calls the same function then it is called as 'recursive function.'
Example:
Recursion()
{
printf("Recursion !");
Recursion();
}

138. What is self referentialstructure ?
A self-referential structure is one of the data structures which refer to the pointer to (points) to another structure of the same type.

139. What is far pointer?
The pointer which can point or access whole the residence memory of RAM i.e. which can access all 16 segments is known as far pointer.

140. What is pascal and cdecl keyword in c language?
There are two types of parameters passing conventions in c:
1. pascal: In this style function name should (not necessary ) in the uppercase .First parameter of function call is passed to the first parameter of function definition and so on.
2. cdecl: In this style function name can be both in the upper case or lower case. First parameter of function call is passed to the last parameter of function definition. It is default parameter passing convention.