New C Code Interview Questions :: ALLInterview.com http://www.allinterview.com New C Code Interview Questions en-us How to count a sum, when the numbers are read from stdin and stored i http://www.allinterview.com/showanswers/100754.html How we print the table of 3 using for loop in c programing? http://www.allinterview.com/showanswers/100186.html int i; for(i=1;i<=10;i++) { i=i*3; printf("%d",i); } How we print the table of 2 using for loop in c programing? http://www.allinterview.com/showanswers/100184.html main() { char a[4]=&quot;HELL&quot;; printf(&quo http://www.allinterview.com/showanswers/99713.html Answer : HELL%@!~@!@???@~~! Explanation: The character array has the memory just enough to hold the string “HELL” and doesnt have enough space to store the terminating null character. So it prints the HELL correctly and continues to pri char *someFun1() { char temp[ ] = “string&quot;; return http://www.allinterview.com/showanswers/99712.html Answer : Garbage values. Explanation: Both the functions suffer from the problem of dangling pointers. In someFun1() temp is a character array and so the space for it is allocated in heap and is initialized with character string “strin char *someFun() { char *temp = “string constant&quot;; http://www.allinterview.com/showanswers/99711.html Answer : string constant Explanation: The program suffers no problem and gives the output correctly because the character constants are stored in code/data area and not allocated in stack, so this doesn’t lead to dangling pointers. Printf can be implemented by using __________ list. http://www.allinterview.com/showanswers/99710.html Answer : Variable length argument lists main() { extern int i; { int i=20; { http://www.allinterview.com/showanswers/99709.html main() { int a=10,*j; void *k; j=k=&amp http://www.allinterview.com/showanswers/99708.html Answer : Compiler error: Cannot increment a void pointer Explanation: Void pointers are generic pointers and they can be used only when the type is not known and as an intermediate address storage type. No pointer arithmetic can main() { char a[4]=&quot;HELLO&quot;; print http://www.allinterview.com/showanswers/99707.html Answer : Compiler error: Too many initializers Explanation: The array a is of size 4 but the string constant requires 6 bytes to get stored. Is this code legal? int *ptr; ptr = (int *) 0x400; http://www.allinterview.com/showanswers/99706.html Answer : Yes Explanation: The pointer ptr will point at the integer in the memory location 0x400. void main() { char ch; for(ch=0;ch&lt;=127; http://www.allinterview.com/showanswers/99705.html Answer : Implementaion dependent Explanation: The char type may be signed or unsigned by default. If it is signed then ch++ is executed after ch reaches 127 and rotates back to -128. Thus ch is always smaller than 127. void main() { int i=10, j=2; int *ip= &amp; http://www.allinterview.com/showanswers/99704.html Answer : Compiler Error: “Unexpected end of file in comment started in line 5”. Explanation: The programmer intended to divide two integers, but by the “maximum munch” rule, the compiler treats the operator sequence / and * Which version do you prefer of the following two, 1) printf(“ http://www.allinterview.com/showanswers/99703.html Answer : & Explanation: Prefer the first one. If the str contains any format characters like %d then it will result in a subtle bug. char inputString[100] = {0}; To get string input from the key http://www.allinterview.com/showanswers/99702.html Answer : & Explanation: The second one is better because gets(inputString) doesn't know the size of the string passed and so, if a very big input (here, more than 100 chars) the charactes will be written past the input string. When fg