Professional Documents
Culture Documents
C Interview Questions and Answers
C Interview Questions and Answers
[C Frequently
int x=5;
printf(%d,%d,%d\n,x,x<<2,>>2)
;
}
as x = 5 = 00000,0101; so x << 2 -< 00001,0100 = 20; x >7gt; 2 -> 00000,0001
= 1. Therefore, the answer is 5, 20 , 1
Answer: 5,20,1
Answer: 10, 5
printf(%s\n,ptr);
}
1) ptr++ increments the ptr address to point to the next address. In the previous
example, ptr was pointing to the space in the string before C, now it will point to C.
2)*ptr++ gets the value at ptr++, the ptr is indirectly forwarded by one in this case.
3)(*ptr)++ actually increments the value in the ptr location. If *ptr contains a space,
then (*ptr)++ will now contain an exclamation mark.
Answer: Tech Preparation
p1=(char *)malloc(25);
p2=(char *)malloc(25);
strcpy(p1,Tech);
strcpy(p2,preparation);
strcat(p1,p2);
printf(%s,p1)
;
}
Answer: Techpreparation
The following variable is available in file1.c, who can access it?: static int
average;
Answer: all the functions in the file1.c can access the variable.