void main()
{
static int i=i++, j=j++, k=k++;
printf(“i = %d j = %d k = %d”, i, j, k);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
i = 1 j = 1 k = 1
Explanation:
Since static variables are initialized to zero by default.
| Is This Answer Correct ? | 12 Yes | 8 No |
Answer / mittu
0 ,0 ,0
It gives 0 0 0 for all three.
Cause at compile time compiler assigns memory to the static variable in HEAP. So these are automatically initialized to 0.
So First Allocation and then Initialization takes place.
At compile time it allocates memory to i,j,k.
And then initialization phase first is assigns 0 to 'i','j' and 'k' and
then it uses this ++ for increment the value at "Increment Buffer".
So i,j,k are initialized by 0 and value of i , j,k is incremented by 1 in "Increment Buffer".
THIS IS DONE AT COMPILE TIME.
Now at run time it refers the value of i,j and k from HEAP.
And at run time it skips "static statements".
So in HEAP value of i , j, and k is 0(zero).
| Is This Answer Correct ? | 5 Yes | 1 No |
write a program to Insert in a sorted list
abcdedcba abc cba ab ba a a
main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
Is it possible to type a name in command line without ant quotes?
main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }
func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }
main() { int i=5; printf("%d",++i++); }
main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above
main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above
#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }
{ int *ptr=(int*)malloc(sizeof(int)); *ptr=4; printf("%d",(*ptr)+++*ptr++); }