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



void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, ..

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

void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, ..

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

void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, ..

Answer / ankur

illegal initialization

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More C Code Interview Questions

main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 Answers  


Cluster head selection in Wireless Sensor Network using C programming language.

0 Answers  


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  


main() { clrscr(); } clrscr();

2 Answers  


main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }

2 Answers   HP,






write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30

0 Answers  


const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,


How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...

6 Answers   Microsoft, MSD, Oracle,


main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }

1 Answers   TCS,


what is oop?

3 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }

2 Answers   IBM,


Categories