-
Can the sizeof operator be used to tell the size of an array passed to a function?
No. There’s no way to tell, at runtime, how many elements are in an array parameter just by looking at the array parameter itself. Remember, passing an array to a function is exactly the same as passing a pointer to the first element.
-
Why n++ executes faster than n+1?
The expression n++ requires a single machine instruction such as INR to carry out the increment operation whereas, n+1 requires more instructions to carry out this operation.
-
What are the advantages of auto variables?
1)The same auto variable name can be used in different blocks2)There is no side effect by changing the values in the blocks3)The memory is economically used 4)Auto variables have inherent protection because of local scope
-
Diffence arrays and pointers?
Ø Pointers are used to manipulate data using the address. Pointers use * operator to access the data pointed to by themØ Arrays use subscripted variables to access and manipulate data.Array variables can be equivalently written using pointer expression.
-
-
-
-
-
printf("Address of j=%un",&j);
printf("Address of k=%un",&k);
return 0;
}
Suppose the answer is:
Address of i=2004
Address of j=2002
Address of k=2000
why is the address decreasing ?">Consider the following program:#includemain(){int i=3;int *j;int **k;j=&i;k=&j;printf("Address of i=%un",&i);printf("Address of j=%un",&j);printf("Address of k=%un",&k);return 0;}Suppose the answer is:Address of i=2004Address of j=2002Address of k=2000why is the address decreasing ?
-
-
-
-
puts (wer):
1. prints the string 8 8 8
2. prints the null string
3. prints the string m, n, b
4. none of these
">The following program fragment int m=n=b=8; char wer[80]; sprintf(wer, "%d%d%d", m, n, b,); puts (wer): 1. prints the string 8 8 8 2. prints the null string 3. prints the string m, n, b 4. none of these
-
-
-
}
">Vi) main(){ extern int i; i=20;printf("%d",i);}
Linker Error : Undefined symbol '_i'Explanation: extern storage class in the following declaration, extern int i;specifies to the compiler that the memory for i is allocated in some other program and that address will be given to the current program at the time of linking. But linker finds that no other variable of name i is available in any other program with...
-
-
-
-
C Interview Questions
Ans